Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Travis CI test configuration to pytest and add matplotlib tests #954

Merged
merged 3 commits into from
Dec 26, 2019

Conversation

jthielen
Copy link
Contributor

As discussed in #947, this PR switches Travis CI to use pytest for Pint's test suite instead of unittest. As a motivating example, basic tests for pint.matplotlib are added (which closes #897).

@jthielen
Copy link
Contributor Author

The switch to pytest seems to be working great, but the matplotlib tests are not matching the baselines I created locally. I'll be taking a look at those, and once I can figure out what is wrong with them, this should be ready for review.

@jthielen jthielen marked this pull request as ready for review December 26, 2019 22:30
@jthielen
Copy link
Contributor Author

All the tests are passing now, so this should be ready for review and merge.

@hgrecco
Copy link
Owner

hgrecco commented Dec 26, 2019

bors r+

bors bot added a commit that referenced this pull request Dec 26, 2019
954: Switch Travis CI test configuration to pytest and add matplotlib tests r=hgrecco a=jthielen

As discussed in #947, this PR switches Travis CI to use pytest for Pint's test suite instead of unittest. As a motivating example, basic tests for `pint.matplotlib` are added (which closes #897).

- [x] Closes #897, towards #947 (but does not fully resolve it)
- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [x] The change is fully covered by automated unit tests
- ~~Documented in docs/ as appropriate~~
- [x] Added an entry to the CHANGES file


Co-authored-by: Jon Thielen <github@jont.cc>
@hgrecco
Copy link
Owner

hgrecco commented Dec 26, 2019

Just as a a reminder for the future. Now that pytest is available we could streamline some of the existing tests to make good use of it.

@bors
Copy link
Contributor

bors bot commented Dec 26, 2019

Build succeeded

@bors bors bot merged commit f666135 into hgrecco:master Dec 26, 2019
@westurner
Copy link
Contributor

westurner commented Dec 27, 2019

👍

@pytest.mark.parametrize might make it easier to identify the test failures by creating named test cases for each combination.

ParametrizedTestCase:

https://github.com/hgrecco/pint/blob/2503f00762d1bc159ab196e2de93963f257629dd/pint/testsuite/parameterized.py

pytest.mark.parametrize:

https://github.com/pytest-dev/pytest/blob/8be9684ab23220cc85abb06e06414961667340b3/src/_pytest/python.py#L918-L922

https://github.com/pytest-dev/pytest/blob/8be9684ab23220cc85abb06e06414961667340b3/src/_pytest/python.py#L987-L990 :

       # create the new calls: if we are parametrize() multiple times (by applying the decorator
       # more than once) then we accumulate those calls generating the cartesian product
       # of all calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement tests for matplotlib functionality
3 participants