Skip to content

Commit

Permalink
Maintenance: removed py35 and skipped broken tests (#120)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Bednar <[email protected]>
  • Loading branch information
lukas-bednar authored Dec 2, 2021
1 parent 5e54d1b commit da1580a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ classifier=
Operating System :: POSIX
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Topic :: Software Development :: Testing
Topic :: Software Development :: Quality Assurance
Topic :: Utilities
Expand Down
46 changes: 29 additions & 17 deletions tests/test_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

import pytest

PUBLIC_JIRA_SERVER = "https://issues.jboss.org"

SKIP_REASON_UNAUTHORIZED = """
Current public jira server doesn't allow anonymous anymore
"""

CONFTEST = """
import pytest
Expand Down Expand Up @@ -58,7 +64,7 @@ def pytest_collection_modifyitems(session, config, items):

PLUGIN_ARGS = (
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
)


Expand Down Expand Up @@ -441,12 +447,12 @@ def test_pass():
""")
ARGS = (
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-user', 'user123',
'--jira-password', 'passwd123'
)
result = testdir.runpytest(*ARGS)
assert '403 Client Error' in result.stdout.str()
assert '401 Client Error' in result.stdout.str()


def test_disabled_ssl_verification_pass(testdir):
Expand All @@ -456,7 +462,7 @@ def test_disabled_ssl_verification_pass(testdir):
'.cfg',
jira="\n".join([
'[DEFAULT]',
'url = https://issues.jboss.org',
"url = " + PUBLIC_JIRA_SERVER,
'ssl_verification = false',
])
)
Expand All @@ -477,7 +483,7 @@ def test_config_file_paths_xfail(testdir):
homedir = testdir.mkdir('home')
os.environ['HOME'] = os.getcwd() + '/home'
homedir.ensure('jira.cfg').write(
'[DEFAULT]\nurl = https://issues.jboss.org',
'[DEFAULT]\nurl = ' + PUBLIC_JIRA_SERVER,
)
assert os.path.isfile(os.getcwd() + '/home/jira.cfg')
testdir.makepyfile("""
Expand Down Expand Up @@ -535,6 +541,7 @@ def test_fail():
assert_outcomes(result, 0, 0, 1)


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
def test_get_issue_info_from_remote_passed(testdir):
testdir.makeconftest(CONFTEST)
testdir.makepyfile("""
Expand All @@ -561,22 +568,23 @@ def test_pass():
result = testdir.runpytest(
'--jira',
'--jira-url',
'https://issues.jboss.org',
PUBLIC_JIRA_SERVER,
'--jira-components',
'com3',
'com1',
)
assert_outcomes(result, 0, 1, 0)


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
def test_strategy_ignore_failed(testdir):
"""Invalid issue ID is ignored and test fails"""
testdir.makeconftest(CONFTEST)
testdir.makefile(
'.cfg',
jira="\n".join([
'[DEFAULT]',
'url = https://issues.jboss.org',
'url = ' + PUBLIC_JIRA_SERVER,
'marker_strategy = ignore',
'docs_search = False',
])
Expand All @@ -592,6 +600,7 @@ def test_fail():
result.assert_outcomes(0, 0, 1)


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
def test_strategy_strict_exception(testdir):
"""Invalid issue ID, exception is rised"""
testdir.makeconftest(CONFTEST)
Expand All @@ -606,21 +615,22 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-marker-strategy', 'strict',
'--jira-issue-regex', '[0-9]+-[0-9]+',
)
assert "89745-1412789456148865" in result.stdout.str()


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
def test_strategy_warn_fail(testdir):
"""Invalid issue ID is ignored and warning is written"""
testdir.makeconftest(CONFTEST)
testdir.makefile(
'.cfg',
jira="\n".join([
'[DEFAULT]',
'url = https://issues.jboss.org',
'url = ' + PUBLIC_JIRA_SERVER,
'marker_strategy = warn',
])
)
Expand Down Expand Up @@ -651,12 +661,13 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-disable-docs-search',
)
assert_outcomes(result, 0, 0, 1)


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
def test_issue_not_found_considered_open_xfailed(testdir):
"""Issue is open but docs is ignored"""
testdir.makeconftest(CONFTEST)
Expand Down Expand Up @@ -686,7 +697,7 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-issue-regex', '[0-9]+-[0-9]+',
)
text = 'JIRA marker argument `ORG-1382` does not match pattern'
Expand All @@ -705,7 +716,7 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-marker-strategy', 'invalid',
)
assert "invalid choice: \'invalid\'" in result.stderr.str()
Expand All @@ -726,7 +737,7 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-resolved-statuses', 'custom-status',
)
assert_outcomes(result, 0, 0, 1)
Expand All @@ -747,7 +758,7 @@ def test_pass():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-resolved-statuses', 'custom-status',
)
assert_outcomes(result, 1, 0, 0)
Expand All @@ -769,7 +780,7 @@ def test_fail():
""")
result = testdir.runpytest(
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-resolved-statuses', 'custom-status,some-other',
)
assert_outcomes(result, 0, 1, 0)
Expand Down Expand Up @@ -801,7 +812,7 @@ def test_run_test_case_false2(testdir):
testdir.makeconftest(CONFTEST)
plugin_args = (
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
'--jira-do-not-run-test-case',
)
testdir.makepyfile("""
Expand Down Expand Up @@ -1020,6 +1031,7 @@ def test_pass(jira_issue):
)


@pytest.mark.skip(reason=SKIP_REASON_UNAUTHORIZED)
@pytest.mark.parametrize("ticket", ['ORG-1382', 'Foo-Bar'])
@pytest.mark.parametrize("return_method, _type", [
('--jira-return-metadata', 'JiraIssue'),
Expand All @@ -1036,7 +1048,7 @@ def test_pass(jira_issue):
""" % (ticket, _type))
ARGS = (
'--jira',
'--jira-url', 'https://issues.jboss.org',
'--jira-url', PUBLIC_JIRA_SERVER,
return_method
)
result = testdir.runpytest(*ARGS)
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist = py35,py36,py37,pep8
envlist = py36,py37,py38,pep8
[tox:travis]
3.5 = py35, pep8
3.6 = py36, pep8
3.7 = py37, pep8
3.8 = py38, pep8

[testenv]
deps=
Expand Down

0 comments on commit da1580a

Please sign in to comment.