Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Updated test suite #14

Merged
merged 9 commits into from
Apr 11, 2018
Merged

Conversation

duncanmmacleod
Copy link
Member

@duncanmmacleod duncanmmacleod commented Apr 9, 2018

This PR updates the test suite to include a second test case module! and lots of other things:

  • renamed test/test_gwin.py -> test/test_sampler.py
  • added test/test_io.py (incomplete)
  • added test/test_likelihood.py (incomplete)
  • added test/test_option_utils.py (incomplete)
  • added test/test_results.py (incomplete)
  • added test/utils module with lots of fixtures
  • added conftest.py with --approximants command-line options

The final point means that the suite can now be run using the default approximants with

python setup.py test  # OR
py.test

but you can specify which approximants to use:

py.test --approximants IMRPhenomA IMRPhenomB IMRPhenomC IMRPhenomD

Closes #11.
Fixes #16.

@coveralls
Copy link

coveralls commented Apr 9, 2018

Pull Request Test Coverage Report for Build 70

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+19.06%) to 41.088%

Totals Coverage Status
Change from base Build 67: 19.06%
Covered Lines: 899
Relevant Lines: 2188

💛 - Coveralls

- renamed test_gwin -> test_sampler
- added test_likelihood (incomplete)
- added utils module with lots of fixtures
- added conftest.py with `--approximants` CLO
does not include any tests that require reading files (yet)
so that we don't need multiple try/except imports across the test modules
@duncanmmacleod duncanmmacleod changed the title WIP: Updated test suite Updated test suite Apr 10, 2018
@duncanmmacleod
Copy link
Member Author

ok, @cmbiwer, I should probably stop here and add more unit tests in future PRs, you were automatically assigned because I modified gwpy/io/hdf.py to fix #16.

That commit (790ccfd) is the only to touch module code, all other modify build files, or test files.

@duncanmmacleod duncanmmacleod added pr:bug-fix Backwards-compatible change that does not add new functionality (patch version bump) gwin.io Change to gwin.io sub-package labels Apr 10, 2018
@duncanmmacleod duncanmmacleod added this to the 0.1.0 milestone Apr 10, 2018
DEFAULT_APPROXIMANTS = [
'TaylorF2',
'IMRPhenomPv2',
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add SEOBNRv4 to the default list? How long do the test take as is?

Copy link
Member Author

@duncanmmacleod duncanmmacleod Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vivienr, on my macbook I get the following error:

ValueError: Approximant SEOBNRv4 not available

Is there something special that needs to be done to set up this approximant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a consequence of the test only being set up for frequency-domain waveforms, at the moment. Hopefully I can work with @cdcapano in a future PR to add support for TD waveform approximants.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only available in the time domain, and the tests only do calls in the frequency domain. If that's too much troubles, let's look at implementing time domain versions in another patch.

Copy link
Contributor

@cmbiwer cmbiwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duncanmmacleod I feel like some of the codeclimate thresholds are a bit low. Like this is considered a failure:

Function test_add_sampler_option_group has 26 lines of code (exceeds 25 allowed). Consider refactoring.

Maybe at some future point these could be relaxed a bit.

Otherwise, this PR looks fine.

@vivienr
Copy link
Contributor

vivienr commented Apr 11, 2018

@cmbiwer: I agree. In particular, I'd up the lines of code allowed to 50, the cognitive complexity to 10, allow up to 8 arguments to functions, and 750 lines of codes per file.

@duncanmmacleod duncanmmacleod merged commit 5fd2d64 into gwastro:master Apr 11, 2018
@duncanmmacleod duncanmmacleod deleted the test-cases branch April 11, 2018 15:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
gwin.io Change to gwin.io sub-package pr:bug-fix Backwards-compatible change that does not add new functionality (patch version bump)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typo in InferenceFile.static_args We need more unit tests!
5 participants