jlaska / pytest-github

Plugin for py.test that associates tests with github issues using a marker
MIT License
18 stars 9 forks source link

Update use of get_marker to get_closest_marker #16

Closed kdelee closed 6 years ago

kdelee commented 6 years ago

See https://docs.pytest.org/en/latest/mark.html#updating-code for reference. This update resolves depreciation warnings for "get_marker".

kdelee commented 6 years ago

stab # 2, see that @AlanCoding was working on this recently and had filed #14

kdelee commented 6 years ago

Looks like those 5 tests are also failing for me on master FWIW

AlanCoding commented 6 years ago

I made this PR to get a clean check in Travis https://github.com/jlaska/pytest-github/pull/17

python 2.7 gives

============== 5 failed, 53 passed, 12 warnings in 12.02 seconds ===============

yours gives

=============== 5 failed, 53 passed, 6 warnings in 5.90 seconds ================

the warnings may be due to the issue being fixed here.

AlanCoding commented 6 years ago

yeah, that's right, this PR got rid of


/home/travis/build/jlaska/pytest-github/pytest_github/plugin.py:304: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.
Please use node.get_closest_marker(name) or node.iter_markers(name).
Docs: https://docs.pytest.org/en/latest/mark.html#updating-code
  issue_urls = tuple(sorted(set(marker.args)))  # (O_O) for caching

Looks good to me!

kdelee commented 6 years ago

I'll give this a few more min to see if I can address these failing tests, even though they appear to be stale for other reasons unrelated to these changes

kdelee commented 6 years ago

Also FWIW -- I have pip installed this version and run test modules that use the github marker and all seems to be working

jlaska commented 6 years ago

Thanks for the fix! Can we fix the tests too?

kdelee commented 6 years ago

Working off master to diagnose these test failures...something is going on with

https://github.com/jlaska/pytest-github/blob/a44116dec18c4bfcf4eaa8f8d8496e2f5cbbca1c/pytest_github/plugin.py#L232

kdelee commented 6 years ago

Re: our discussion I filed https://github.com/jlaska/pytest-github/issues/18 to track fixing those tests.

We have decided to merge these changes, which appear to have no effect on those existing issues

jlaska commented 6 years ago

Thanks @kdelee! Merging this for now, and we can address potential test changes later.