-
Notifications
You must be signed in to change notification settings - Fork 27
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
Various fixes to tests infrastructure #246
Conversation
@tiran PTAL |
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.
Hi, @simo5
You could use get_closest_marker
.
For example,
- if skip_servertest and item.get_marker("servertest") is not None:
+ # pytest 4+
+ if hasattr(item, 'get_closest_marker'):
+ get_marker = item.get_closest_marker
+ else:
+ get_marker = item.get_marker
+ if skip_servertest and get_marker("servertest") is not None:
@stanislavlevin would you mind reviewing this PR given you proposed #248 and therefore are familiar with the issue ? |
Please, let me check. |
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.
@simo5, hi! Please, see inline comments.
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.
- if skip_servertest and item.get_marker("servertest") is not None:
+ # pytest 4+
+ if hasattr(item, 'get_closest_marker'):
+ get_marker = item.get_closest_marker
+ else:
+ get_marker = item.get_marker
+ if skip_servertest and get_marker("servertest") is not None:
You could use a simpler version of fix with support of pytest < 4 .
@stanislavlevin thanks for the review, sorry for late reply, I was away |
Do you have a suggestion ? |
That diff is the suggestion ;-) |
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.
- if skip_servertest and item.get_marker("servertest") is not None: + # pytest 4+ + if hasattr(item, 'get_closest_marker'): + get_marker = item.get_closest_marker + else: + get_marker = item.get_marker + if skip_servertest and get_marker("servertest") is not None:You could use a simpler version of fix with support of pytest < 4 .
Do you have a suggestion ?
Heh, nevermind, I just now realized this was the suggestion ... sometimes the github UI makes it confusing to distinguish actual code quoted from proposed code quoted ...
That said,
I am not sure get_closest_marker gives me what I want, I had considered it and decided to check for the specific marker.
But what I can do is retain the pytest < 4 code for backwards compat I guess.
make was broken in various ways on my F30 machine. - Some minor liniting issues - A connection reset by peer error instead of SSLv3 alert on some python versions - disabled python36-extras because it fails with a missing ipalib error - renamed all extrs/noextra to extras/noextras ... - fixed pytest deprecation warning error about using pytset.config Signed-off-by: Simo Sorce <simo@redhat.com>
Ok rebased with the requested changes, modulo differences in how to handle the get_marker replacement |
Please, take a look at the official docs: for marker in item.iter_markers():
if marker.name == "servertest":
# args has --skip-servertests and test is marked as servertest
pytest.skip("Skip integration test") The iteration is extra operation here, because if skip_servertest:
if next(item.iter_markers("servertest"), None) is not None:
# args has --skip-servertests and test is marked as servertest
pytest.skip("Skip integration test") or you could just use the syntax sugar ( Internally, Honestly speaking, the custodia test suite has only 1 mark and only one level for this mark, so, it doesn't matter how to handle this one 😄 But... |
Another one point, what is about Python3.7 at Travis? |
Ok let me use get_closer_marker() and if later we have issues we'll fix em later... As for py37 I think I tried to add it and something else blew up so I backed out :) |
Pushed, let's see what happens |
@stanislavlevin sounds like all checks pass, can you approve a review? (can't recall if permissions are set up that you can or not, let me know if you can't) |
Sigh realized now I had opened this PR from a origin branch ... then kept pushing changes to my personal branch ... oooh well.. |
Codecov Report
@@ Coverage Diff @@
## master #246 +/- ##
==========================================
+ Coverage 73.73% 74.14% +0.41%
==========================================
Files 40 40
Lines 4401 4409 +8
Branches 447 453 +6
==========================================
+ Hits 3245 3269 +24
+ Misses 988 980 -8
+ Partials 168 160 -8
Continue to review full report at Codecov.
|
I've checked this PR locally against Python 3.7.3.
The method should be 'get_closest_marker', not 'get_closer_marker' ;-) |
get_marker has been removed in pytest 4, so replace it with their suggested work around. Signed-off-by: Simo Sorce <simo@redhat.com>
Oh my ... should be fixed now |
|
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.
All tests passed.
You could merge directly, aren't you? |
Done, |
Thank you too! |
Fix issues cropping up with newer python tools versions
Fixes #245
Fixes #247