-
Notifications
You must be signed in to change notification settings - Fork 456
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
Improve handling if LONG_TESTS not set #591
Conversation
Codecov Report
@@ Coverage Diff @@
## master #591 +/- ##
==========================================
- Coverage 86.03% 84.51% -1.53%
==========================================
Files 62 63 +1
Lines 2421 2447 +26
Branches 488 492 +4
==========================================
- Hits 2083 2068 -15
- Misses 218 254 +36
- Partials 120 125 +5
Continue to review full report at Codecov.
|
Pinging @pdxjohnny for review. Also, while this works, I'm open to suggestions of ways to make it more elegant. I was trying to make sure you could still search for "LONG_TESTS" and find the right thing for easier debugging, but it does feel a little weird to have it actually secretly be a function now. |
@@ -175,13 +175,15 @@ In #99, I've added a _file_test function (to match the existing _binary_test) th | |||
..... | |||
..... | |||
..... | |||
@unittest.skipUnless(int(os.getenv("LONG_TESTS")) > 0, "Skipping long tests") | |||
@unittest.skipUnless(LONG_TESTS() > 0, "Skipping long tests") |
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.
We could do something like this too (get from os.environ
and provide default of 0 if it doesn't exist):
@unittest.skipUnless(LONG_TESTS() > 0, "Skipping long tests") | |
@unittest.skipUnless(int(os.environ.get("LONG_TESTS", 0)) > 0, "Skipping long tests") |
But I do like the idea of having it be a function, since then we only have to change the logic in one place if we decide to incorporate other checks
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.
the problem was that int(os.environ.get()) fails if LONG_TESTS is not set (because int() won't work on an empty string). We could fit an if in there to handle that, but it looked pretty unwieldly so I went with the function.
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.
ah wait, no I see you're talking a different function than the one that was failing. maybe environ gives something more tractable than getenv did. didn't test that one.
Fixes #590