Skip to content

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

Merged
bors[bot] merged 3 commits into
hgrecco:masterfrom
jthielen:pytest-and-mpl-tests
Dec 26, 2019
Merged

Switch Travis CI test configuration to pytest and add matplotlib tests#954
bors[bot] merged 3 commits into
hgrecco:masterfrom
jthielen:pytest-and-mpl-tests

Conversation

@jthielen
Copy link
Copy Markdown
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
Copy Markdown
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 force-pushed the pytest-and-mpl-tests branch from ffa0319 to f666135 Compare December 26, 2019 22:30
@jthielen jthielen marked this pull request as ready for review December 26, 2019 22:30
@jthielen
Copy link
Copy Markdown
Contributor Author

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

@hgrecco
Copy link
Copy Markdown
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 <[email protected]>
@hgrecco
Copy link
Copy Markdown
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
Copy Markdown
Contributor

bors Bot commented Dec 26, 2019

Build succeeded

@bors bors Bot merged commit f666135 into hgrecco:master Dec 26, 2019
@westurner
Copy link
Copy Markdown
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