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 tests to use correct exit code #19

Closed kdelee closed 5 years ago

kdelee commented 5 years ago

This fixes 4 of the 5 failing tests....

the 5th one is acting weird. Something is capturing the warning in such a way that I neither the with pytest.warns... nor the recwarn fixture are getting access to the warning, despite the fact that the warning is being emitted.

============================================================================ test session starts ============================================================================
platform linux2 -- Python 2.7.15, pytest-3.8.0, py-1.6.0, pluggy-0.7.1
ansible: 2.6.4
rootdir: /tmp/pytest-of-elijah/pytest-62/test_with_private_issue_link0, inifile:
plugins: ordering-0.5, mp-0.0.4, cov-2.6.0, ansible-2.0.1, pylama-7.4.3, github-0.0.10
collecting 1 item                                                                                                                                                           collected 0 github issues
collected 1 item                                                                                                                                                            
There should be 1 tests run.

test_with_private_issue_link.py .                                                                                                                                     [100%]

============================================================================= warnings summary ==============================================================================
/home/elijah/sfw/ansible/pytest-github/pytest_github/plugin.py:316: UserWarning: Unable to inspect github issue https://github.com/github/github/issues/1 - No valid github session found to access private issue.
  warnings.warn(errstr, UserWarning)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=================================================================== 1 passed, 1 warnings in 0.01 seconds ====================================================================
FAILED
kdelee commented 5 years ago

Ok, got this working now. Decided to run the tests inside the test looking for the warning a bit differently using https://docs.pytest.org/en/latest/writing_plugins.html#testing-plugins as a guide.

jlaska commented 5 years ago

Thanks for these fixes, merging!