diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..aa0939e4143cdd9a133e11f9e1633ff15cae7fc3 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +omit = + test/example_test.py + test/gw_example_test.py + test/noise_realisation_test.py + test/other_test.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 786fca950b3bdb34f636becd514bc08adde636df..9376bae256d0629c6eec2e9d7ad34533e98ffc01 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,11 +21,11 @@ python-2: - apt install -y libgl1-mesa-glx - pip install -r requirements.txt - pip install -r optional_requirements.txt - - pip install lalsuite enum gwpy + - pip install enum script: - python setup.py install # Run tests without finding coverage - - for test in test/*tests.py; do python $test; done + - pytest # test example on python 3 python-3: @@ -39,6 +39,7 @@ python-3: - pip install 'coverage>=4.5' - pip install coverage-badge - pip install flake8 + - pip install pytest-cov script: - python setup.py install @@ -46,23 +47,9 @@ python-3: - flake8 . # Run tests and collect coverage data - - coverage --version - - coverage erase - - coverage run --debug=trace --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/conversion_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/calibration_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/detector_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/gw_likelihood_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/likelihood_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/prior_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/sampler_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/utils_tests.py - - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/waveform_generator_tests.py + - pytest --cov=tupak - coverage html - coverage-badge -o coverage_badge.svg -f - # Run all other tests (no coverage data collected) - - python test/example_tests.py - - python test/gw_example_tests.py - - python test/noise_realisation_tests.py # Make the documentation - pip install -r docs/requirements.txt diff --git a/setup.cfg b/setup.cfg index b3193025616f3b927a9577042f31dac094ad95df..b1e3bbe886b74ad4ac8fba910a11027596dab54b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,3 +2,7 @@ exclude = .git,docs,build,dist,test,examples,*__init__.py max-line-length = 160 ignore = E129 + +[tool:pytest] +addopts = + --ignore test/other_test.py diff --git a/test/calibration_tests.py b/test/calibration_test.py similarity index 100% rename from test/calibration_tests.py rename to test/calibration_test.py diff --git a/test/conversion_tests.py b/test/conversion_test.py similarity index 100% rename from test/conversion_tests.py rename to test/conversion_test.py diff --git a/test/detector_tests.py b/test/detector_test.py similarity index 100% rename from test/detector_tests.py rename to test/detector_test.py diff --git a/test/example_tests.py b/test/example_test.py similarity index 100% rename from test/example_tests.py rename to test/example_test.py diff --git a/test/gw_example_tests.py b/test/gw_example_test.py similarity index 100% rename from test/gw_example_tests.py rename to test/gw_example_test.py diff --git a/test/gw_likelihood_tests.py b/test/gw_likelihood_test.py similarity index 100% rename from test/gw_likelihood_tests.py rename to test/gw_likelihood_test.py diff --git a/test/likelihood_tests.py b/test/likelihood_test.py similarity index 100% rename from test/likelihood_tests.py rename to test/likelihood_test.py diff --git a/test/noise_realisation_tests.py b/test/noise_realisation_test.py similarity index 100% rename from test/noise_realisation_tests.py rename to test/noise_realisation_test.py diff --git a/test/other_tests.py b/test/other_test.py similarity index 100% rename from test/other_tests.py rename to test/other_test.py diff --git a/test/prior_tests.py b/test/prior_test.py similarity index 100% rename from test/prior_tests.py rename to test/prior_test.py diff --git a/test/utils_tests.py b/test/utils_test.py similarity index 100% rename from test/utils_tests.py rename to test/utils_test.py diff --git a/test/waveform_generator_tests.py b/test/waveform_generator_test.py similarity index 100% rename from test/waveform_generator_tests.py rename to test/waveform_generator_test.py