Move pytest options to pytest inifile#76
Conversation
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
==========================================
+ Coverage 99.34% 99.56% +0.21%
==========================================
Files 19 19
Lines 461 461
Branches 43 43
==========================================
+ Hits 458 459 +1
Misses 2 2
+ Partials 1 0 -1
Continue to review full report at Codecov.
|
|
Looks good to me, thanks! (Not sure why the coverage changes...) |
|
I don't understand what that error is saying, or why this change fixes it. Can anyone explain? Is it: pytest was finding two copies of pytest-trio, one in the current directory and one in site-packages, and getting confused by that? And creating a pytest.ini file forces pytest to treat that directory as the root? Does the contents of the file matter? The full options there are good for CI where you can't easily re-run tests, but not what I normally like for local runs... Or is it the Does the CI's trick of running from an empty subdirectory to test the installed version, instead of the version in the source tree, still work? |
Yes, as far as I can tell.
It does, although this doesn't influence the import mechanism. I just realized the rootdir is not used by coverage to find the
Yes. Actually, pytest does not add the current directory to EDIT: I just realized it does add the root of the repository to
I agree. I can make a new PR from the following patch: diff --git a/ci/travis.sh b/ci/travis.sh
index 6cee6a7..201cdb5 100755
--- a/ci/travis.sh
+++ b/ci/travis.sh
@@ -92,7 +92,7 @@ else
mkdir empty
cd empty
- pytest
+ pytest -r a --verbose --cov --cov-config=../.coveragerc
bash <(curl -s https://codecov.io/bash)
fi
diff --git a/pytest.ini b/pytest.ini
index e7e9beb..e31f910 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,2 +1,2 @@
[pytest]
-addopts = -W error -ra -v --pyargs pytest_trio --verbose --cov
+addopts = -W error --pyargs pytest_trioI rushed it a bit, sorry about that. In the long run, it could be nice to use tox or something similar. |
A naive
pytestrun currently fails with the following trace:This PR moves the pytest options defined in
ci/travis.shto a pytest inifile. I had to create a newpytest.inifile sincepyproject.tomlisn't supported by pytest yet. This shouldn't break the CI (hopefully).