diff --git a/Makefile b/Makefile index cbe63487..11217658 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ production: @true docs: - tox -e docs + tox -c tests/tox.ini -e docs dev: $(LOCAL_CONFIG_DIR) $(LOGS_DIR) install-hooks @@ -14,14 +14,15 @@ install-hooks: pre-commit install -f --install-hooks test: - tox + tox -c tests/tox.ini test-elasticsearch: - tox -- --runelasticsearch + tox -c tests/tox.ini -- --runelasticsearch test-docker: - docker-compose --project-name elastalert build tox - docker-compose --project-name elastalert run --rm tox tox -- $(filter-out $@,$(MAKECMDGOALS)) + docker-compose -f tests/docker-compose.yml --project-name elastalert build tox + docker-compose -f tests/docker-compose.yml --project-name elastalert run --rm tox \ + tox -c tests/tox.ini -- $(filter-out $@,$(MAKECMDGOALS)) clean: make -C docs clean diff --git a/requirements-dev.txt b/requirements-dev.txt index ea0c8239..7abc7740 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,5 @@ -r requirements.txt docutils<0.17 -pytest-cov==2.12.1 flake8 flake8-absolute-import m2r2 @@ -8,7 +7,9 @@ pluggy>=0.12.0 pre-commit pylint<2.9 pytest==6.2.4 +pytest-cov==2.12.1 pytest-xdist==2.3.0 setuptools +sphinx==4.0.2 sphinx_rtd_theme tox==3.23.1 diff --git a/Dockerfile-test b/tests/Dockerfile-test similarity index 100% rename from Dockerfile-test rename to tests/Dockerfile-test diff --git a/docker-compose.yml b/tests/docker-compose.yml similarity index 60% rename from docker-compose.yml rename to tests/docker-compose.yml index 88badf6e..7b8dd285 100644 --- a/docker-compose.yml +++ b/tests/docker-compose.yml @@ -2,10 +2,10 @@ version: '2' services: tox: build: - context: ./ - dockerfile: Dockerfile-test + context: ../ + dockerfile: tests/Dockerfile-test command: tox container_name: elastalert_tox working_dir: /home/elastalert volumes: - - ./:/home/elastalert/ + - ../:/home/elastalert/ diff --git a/pytest.ini b/tests/pytest.ini similarity index 61% rename from pytest.ini rename to tests/pytest.ini index 259ba35a..d859f3a9 100644 --- a/pytest.ini +++ b/tests/pytest.ini @@ -2,4 +2,4 @@ markers = elasticsearch: mark a test as using elasticsearch. filterwarnings = - ignore::pytest.PytestUnhandledThreadExceptionWarning \ No newline at end of file + ignore::pytest.PytestUnhandledThreadExceptionWarning diff --git a/tox.ini b/tests/tox.ini similarity index 77% rename from tox.ini rename to tests/tox.ini index 6f42fae2..0a6ad235 100644 --- a/tox.ini +++ b/tests/tox.ini @@ -1,16 +1,16 @@ [tox] project = elastalert envlist = py39,docs +setupdir = .. [testenv] -deps = -rrequirements-dev.txt +deps = -r../requirements-dev.txt commands = - pytest --cov=elastalert --cov-report=term-missing --cov-branch --strict-markers tests/ -n 4 {posargs} - flake8 . + pytest --cov=elastalert --cov-report=term-missing --cov-branch --strict-markers . -n 4 {posargs} + flake8 --config ../setup.cfg . [testenv:lint] deps = {[testenv]deps} - pylint commands = pylint --rcfile=.pylintrc elastalert pylint --rcfile=.pylintrc tests @@ -24,6 +24,5 @@ norecursedirs = .* virtualenv_run docs build venv env [testenv:docs] deps = {[testenv]deps} - sphinx==4.0.2 -changedir = docs +changedir = ../docs commands = sphinx-build -b html -d build/doctrees -W source build/html