diff --git a/requirements.txt b/requirements.txt index 3991995..ee33381 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,9 @@ requests # Dependencies of the tests requests-mock -pylint==1.9.3 -astroid==1.6.5 +pylint==1.8.3 +astroid==1.6.0 flask==1.1.1 +isort==4.3.4 subprocess32==3.5.4 ; python_version=='2.7' werkzeug==0.15.5 diff --git a/stbt_rig.py b/stbt_rig.py index 00e2e9a..1188ee3 100755 --- a/stbt_rig.py +++ b/stbt_rig.py @@ -6,7 +6,7 @@ For more details, and to get the latest version of this script, see . -Copyright 2017-2019 Stb-tester.com Ltd. +Copyright 2017-2020 Stb-tester.com Ltd. Released under the MIT license. """ @@ -839,7 +839,8 @@ def list_results(self): def list_results_xml(self): r = self.portal._get( - '/api/v2/results.xml', params={'filter': 'job:%s' % self.job_uid}) + '/api/v2/results.xml', params={'filter': 'job:%s' % self.job_uid, + 'include_tz': 'true'}) r.raise_for_status() return r.text @@ -1222,22 +1223,40 @@ def pytest_addoption(parser): def pytest_collect_file(path, parent): if path.ext == ".py": - return StbtCollector(path, parent) + if hasattr(StbtCollector, "from_parent"): + # pytest >v5.4 + return StbtCollector.from_parent(parent=parent, fspath=path) # pylint:disable=no-member + else: + # Backwards compat + # https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent + return StbtCollector(path, parent) else: return None class StbtCollector(pytest.File): + # pylint: disable=abstract-method def collect(self): with open(self.fspath.strpath) as f: # We implement our own parsing to avoid import stbt ImportErrors for n, line in enumerate(f): m = re.match(r'^def\s+(test_[a-zA-Z0-9_]*)', line) if m: - yield StbtRemoteTest(self, self.name, m.group(1), n + 1) + if hasattr(StbtRemoteTest, "from_parent"): + # pytest >v5.4 + srt = StbtRemoteTest.from_parent( # pylint:disable=no-member + parent=self, filename=self.name, + testname=m.group(1), line_number=n + 1) + else: + # Backwards compat + # https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent + srt = StbtRemoteTest( + self, self.name, m.group(1), n + 1) + yield srt class StbtRemoteTest(pytest.Item): + # pylint: disable=abstract-method def __init__(self, parent, filename, testname, line_number): super(StbtRemoteTest, self).__init__(testname, parent) self._filename = filename diff --git a/test_stbt_rig.py b/test_stbt_rig.py index 253a01f..aca72b7 100644 --- a/test_stbt_rig.py +++ b/test_stbt_rig.py @@ -208,6 +208,7 @@ def get_results(): @self.app.route('/api/v2/results.xml') def get_results_xml(): assert flask.request.args['filter'] == 'job:/mynode/6Pfq/167' + assert flask.request.args['include_tz'] == 'true' return PortalMock.RESULTS_XML @self.app.route('/api/v2/results/') @@ -276,7 +277,7 @@ def on_run_tests(self, j): RESULTS_XML = ( '' + 'timestamp="2019-06-12T15:26:35+00:00">' '' '')