-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Make running individual Python tests less painful #6791
Conversation
n.b. most of the additional lines are top-level directory duplications to work around the lack of namespace package support in auditwheel (and, in a strange twist of fate, this hack works with wheels, but not with installing from source, so The only tests I'm unsure about succeeding are the performance smoke tests. Following that the DNM will be removed and reviewers assigned. |
25aeac4
to
cc10012
Compare
I... dislike... Mac OS X and it's almost-being-Linux-but-everyone-treating-it-slightly-differently-cascading-into-my-face. It is... unpleasant. |
@nathanielmanistaatgoogle This was basically what I rebased your commits on top of for debugging poirposes 🐬. |
"""Run the protocol buffer compiler with the given command-line arguments. | ||
|
||
Args: | ||
command_arguments: a list (yes, it *must* be a list) of strings representing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for parenthetical, although I appreciate the sentiment.
"Make running individual Python tests less painful" is too brief a commit log message - may I trouble you for "before, the difficulty was ..." and "with this change, the developer experience is ..." embellishments? |
How exactly is running individual python tests painful? Are you aware you can do run_tests.py -l python -r REGEX where regex is matched against the name of the python test? |
Btw, ./tools/run_tests/build_python.sh is not something you should invoke yourself (at least that's the idea for other languages and I don't think python should be different). If you want to just build, you can run run_tests.py --build_only, which is going to work well for other languages as well. |
@jtattermusch The output gets eaten on interrupt, the PID of the process has to be guessed at so GDB attachment takes some guesswork on each run, and working around any of those requires an encyclopedic knowledge of our environment variable names. These details will be added in the updated commit message. |
@jtattermusch Build-only might be available as an option on |
c7a2629
to
01d37bb
Compare
Rebased. Also removed |
Also the changes up through ecc3cfa will play a major role in getting the Python-on-Windows tests to work on JenkinsBecause indirect-things-cascading-into-everything-else (coming soon to a PR near you). |
I'm not fully convinced that putting unit tests in a separate module is best way to go. In most (all) python modules I've encountered, unit tests get packaged with the module they test. I can't find much discussion of the pros/cons to this approach online, so to be solidly convinced this is the way we should be doing things, I would need more information around what specifically doesn't work, and why a separate package is the best (or only) way to solve that problem. The two problems that I understand are addressed here are Windows testing and gdb support. I don't have much context for the Windows issues, and it seems like the Also, I think we should hold off on merging this until the namespace issues that cause us to duplicate large chunks of code into grpcio_tools are resolved. |
@@ -119,9 +116,13 @@ | |||
# For Python3.4, this is OSX 10.6, but we need Thread Local Support (__thread) | |||
if 'darwin' in sys.platform and PY3: | |||
mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') | |||
# The working computer's mac os x version defines what frameworks are | |||
# available to build against. | |||
mac_version = platform.mac_ver()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a mac not build against older frameworks? I'm concerned about us compiling binaries against a high MACOSX_DEPLOYMENT_TARGET
. I'm pretty sure our macos jenkins workers are post 10.7, but they are able to build against that target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got errors building locally against 10.7 (missing standard library header files). If that sounds familiar to you and you have an environment fix s.t. the proper configuration is the builder's responsibility, I'd be more than happy to go back to 10.7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arguably, it should be able to (heck, it builds against 10.6 sans __thread
), but for whatever reason I kept getting tripped up by missing headers.
Just the one comment, then LGTM. |
LGTM |
Moves all tests into a separate package. This does not change existing supported means of running tests (e.g. through run_tests.py).
Before this change, running Python tests individually required building a tox environment via the run_tests script and then specifying long environment variables to filter out just the test we wanted to run (and then we wouldn't be able to get the output on interrupt, nor would we have an easy way of determining the PID of the process for debugger attachment). Now invoking the build_python.sh script creates a workable python virtual environment that includes all necessary libraries and tests (s.t. running a single test is now possible by just knowing the module name). This does not change existing supported means of running tests (e.g. through run_tests.py). An additional way of running individual tests has been introduced. Following invocation of `./tools/run_tests/build_python.sh` (or run_tests.py), one may invoke ./$VENV/bin/python -m $TEST_MODULE_NAME and acquire a single running process that *is* the test process (rather than a parent of the process). $VENV is the virtual environment name specified to `build_python.sh` (defaults to `py27`) and $TEST_MODULE_NAME is what it says on the tin.
We'll need to fix coverage testing in the future anyway (see grpc#6894).
All possibly relevant test failures are flakes of the Jenkins infrastructure. Marking |
Luhguhtum. Woohoo! |
Invoke
./tools/run_tests/build_python.sh
. Invoke./py27/bin/python -m $TEST_MODULE_NAME
. Do a not-sucked-into-/dev/null
-dance.