-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Fix our test layout #274
Comments
Looking at that pytest page again, I guess there's also the option of putting the tests in a top-level Meh. This is making me nervous, like we're swimming upstream here. And as noted above, literally all python eventloops ship their tests, as do other minor packages like setuptools. (pip doesn't, but it also doesn't use a |
Apparently |
Have you read https://hynek.me/articles/testing-packaging/? Hynek has some good arguments for a layout with a |
@sscherfke I am familiar with it, but I find that |
With #2628 merged, we've moved |
I suggest moving Codecov out of |
Right now our test layout is a mess. Tests are included in the package so that users can run
pytest --pyargs trio
to make sure it works on their system, but this prevents the use ofpytest.ini
or configuring extra arguments like--run-slow
fromconftest.py
. We have tests split acrosstrio/tests
andtrio/_core/tests
, and since they're not subdirectories of each other then there's configury that has to be copy-pasted into their appropriateconftest.py
files. (And we're not even consistent about this layout, b/c the tests fortrio/testing/
are intrio/tests/test_testing.py
.) Also these look like public modules, but they aren't really.The major decision to make is, should we continue distributing tests inside trio? The advantage is that users can (perhaps) test the actual real installed version of trio, and they don't even have to set up some weird dev environment or anything. (Though they do need to install the test requirements, which aren't documented anywhere outside a source tree.) The main disadvantages are (a) we're swimming upstream a bit here, as noted by the issues with pytest.ini and friends, (b) it ~doubles the on-disk size of our installed package for a feature that only a tiny tiny fraction of deployments will use.
(Another commonly cited argument for separating tests out of your package is so that you can run the tests from version A against package version B. This doesn't make any sense to me, since our tests are unit tests that are tightly tied to a specific version of trio. It's not like we're implementing some generic 3rd party spec, and if we were then the compliance tests should be a standalone package anyway...)
How much extra disk space are we talking about? It's small, but less trivial than I was expecting. (I guess that 4 KiB minimum block size adds up.) On my laptop on 2017-08-09, building a wheel from trio master and then installing it in a venv,
du
reports that the.py
and.pyc
files take up 1.8 MB total, of which 779 KB is tests. This is not huge in the grand scheme of things, but it's not nothing, either. And in particular in these days of docker deployments, it seems likely that some of our users will be obsessed with making their docker containers smaller and get frustrated and angry about a megabyte of "waste". Maybe this makes sense, maybe not, but it doesn't really matter: making users frustrated and angry is a good thing to avoid no matter why it happens :-).OTOH twisted does ship their tests inside their source tree, and twisted is massive: 27 MB installed, of which 15 MB is tests. And tornado and asyncio seem to as well. (Though distributors do often take special measures to delete CPython's test suite, which would include asyncio's test suite.)
If we do keep the tests inside
trio/
, then they should probably all move and be consolidated undertrio/_tests/
.If we move them outside the source tree, then we probably have to switch to a layout like
tests/
for tests, andsrc/trio
for the actual package. (Explanation.) Which annoys me because it's an extra bit of friction every time you want to open a file, and I find it very handy to run tests or random little scripts directly against the source checkout. Like, tox is cool and all, but it slows things down, and when running locally I want to turn out tests ASAP, in-depth testing is what CI is for.The text was updated successfully, but these errors were encountered: