-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Running and bundling tests with namespace packages #2225
Comments
In https://github.com/GoogleCloudPlatform/google-cloud-python-happybase, I moved the |
@tseaver I'm not super thrilled about |
@jonparrott I've already got the test move done and after that the |
👍 , though I'd love to have @tseaver on board. :) |
The |
@tseaver I'm not sure how |
@dhermes it side-steps the issue of:
By putting them under |
I just tried that in #2223 and it made the failures worse ( |
@dhermes Check what I did in |
@tseaver Thanks for the pointer. My ambiguous "I just tried that" above meant that I copied what you had done there. Unclear on where the failure is. |
@jonparrott This is "resolved" |
👍 |
(Context: PR #2223 towards #1978)
PR #2223's tests can't run because nose will place
cwd
intosys.path
when running tests. This meansimport google.cloud
will import./google/cloud
instead of{env}/lib/python{x}.{y}/site-packages/google/cloud
. This will clobber all othergoogle
namespace packages. There is an long-open issue here, note that Nose has been largely abandoned.There are a two of ways we could resolve this, and maybe we should do both:
pytest
. It's fully compatible with nose/unittest style tests. py.test appropriately deals with namespace/installed packages.On switching to py.test
site-packages
. This can be resolved by either moving the tests to a separate package or installing the package in "editable" mode withpip install -e
. Unfortunately, tox doesn't easily allow you to change the command used to install the package under test. There might be a few hacks (turning off sdist and manually installing the package). Nox however gives you complete control over the creation, here's a simple config that works for gcloud-python.On moving the tests to a test package
The were originally concerns about having the tests in a separate top-level tests package because we didn't want it to get installed with gcloud-python but we did want to distribute the tests. This should be resolvable by telling
find_packages()
to skiptests
and includingtests
inmanifest.in
. This means that wheels and sdists will contain the tests folder for downstream packagers, but pip will not install the tests package intosite-packages
.The text was updated successfully, but these errors were encountered: