| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
To avoid collision had to move most tests into a uniquely named directory. For example the tests in bigquery/unit_tests needed to move to bigquery/unit_tests/bigquery to avoid any name collision. Done via: https://gist.github.com/dhermes/397c731966674da1b42612b723e64895
Done via: $ git grep -l 'from unit_tests._fixtures import' -- vision | > xargs sed -i s/'from unit_tests._fixtures import'/'from unit_tests.vision._fixtures import'/g $ $ git grep -l 'from unit_tests._fixtures import' -- speech | > xargs sed -i s/'from unit_tests._fixtures import'/'from unit_tests.speech._fixtures import'/g $ $ git grep -l 'from unit_tests._testing import ' -- bigtable | > xargs sed -i s/'from unit_tests._testing import '/'from unit_tests.bigtable._testing import '/g
This requires manually collecting from the installed site-packages. See: https://testrun.org/tox/latest/example/pytest.html
|
@tseaver The Travis failure is due to #2486. The change needed to filter for files that exist. candidates, _ = get_affected_files()
python_files = [
candidate for candidate in candidates
if candidate.endswith('.py') and os.path.exists(candidate)]
|
Sorry, something went wrong.
Issue introduced in googleapis#2486.
|
unit_tests/handlers/transports/__init__.py → bigquery/unit_tests/bigquery/__init__.py, that doesn't seem right does it? |
Sorry, something went wrong.
| python_files = [ | ||
| candidate for candidate in candidates if candidate.endswith('.py')] | ||
| candidate for candidate in candidates | ||
| if candidate.endswith('.py') and os.path.exists(candidate)] |
|
I'm grinding my teeth about the issues caused from moving the unit tests out-of-tree: I still think they belong there, which would remove the need to mess with the unittests/ pseudo-package at all. |
Sorry, something went wrong.
|
So from a selfish standpoint, I like having the unit_tests for a package in the package. It makes for less mental tracking while working on things. Might just be me though. |
Sorry, something went wrong.
|
@daspecster RE:
That is just git not really caring where the file went. The __init__.py files are all identical |
Sorry, something went wrong.
|
Chatted with @tseaver and @jonparrott about this and will be putting the unit tests back. |
Sorry, something went wrong.
Fixes internal issue 418025765 🦕
| Back | FazBrowse Home | New Git URL |
This took a lot of wrangling, but eventually I found a solution: make unit_tests a namespace package and then collect from site-packages. This way we only run py.test once instead of 15 times, a huge speedup.
In order to do this I needed to do some renames to avoid collisions (e.g. unit_tests.test_client would have been installed for every sub-package).
The first 3 (of 4 of 5) commits are for the rename. The first two are automated (i.e. I didn't make changes to any files myself) and the third is just a tiny lint cleanup based on the automated changes.
Also relevant: https://testrun.org/tox/latest/example/pytest.html#known-issues-and-limitations