forked from pool/python-stestr
- Update to 2.4.0:
* Discover python executable when discover is not used * various bugfixes - Remove merged patch pyyaml5.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-stestr?expand=0&rev=22
This commit is contained in:
committed by
Git OBS Bridge
parent
0fc34631e0
commit
d4960373d8
@@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 22 12:47:43 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Update to 2.4.0:
|
||||
* Discover python executable when discover is not used
|
||||
* various bugfixes
|
||||
- Remove merged patch pyyaml5.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Mar 17 15:17:55 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
|
@@ -18,14 +18,13 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-stestr
|
||||
Version: 2.3.1
|
||||
Version: 2.4.0
|
||||
Release: 0
|
||||
Summary: A test runner runner similar to testrepository
|
||||
License: Apache-2.0
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/mtreinish/stestr
|
||||
Source: https://files.pythonhosted.org/packages/source/s/stestr/stestr-%{version}.tar.gz
|
||||
Patch0: pyyaml5.patch
|
||||
BuildRequires: %{python_module PyYAML >= 3.10.0}
|
||||
BuildRequires: %{python_module SQLAlchemy}
|
||||
BuildRequires: %{python_module cliff >= 2.8.0}
|
||||
@@ -75,7 +74,6 @@ and has examples.
|
||||
|
||||
%prep
|
||||
%setup -q -n stestr-%{version}
|
||||
%patch0 -p1
|
||||
# do not test sql
|
||||
rm stestr/tests/repository/test_sql.py
|
||||
|
||||
|
137
pyyaml5.patch
137
pyyaml5.patch
@@ -1,137 +0,0 @@
|
||||
From f0c8c1112677367345e9b672ed6716b7b9e4d919 Mon Sep 17 00:00:00 2001
|
||||
From: Masayuki Igawa <masayuki@igawa.io>
|
||||
Date: Sat, 16 Mar 2019 10:47:47 +0800
|
||||
Subject: [PATCH] Use yaml.safe_load instead of yaml.load
|
||||
|
||||
yaml.load(input) is deprecated from PyYAML 5.1[0]. Therefore, some
|
||||
warnings are showed up in a stestr unit test case which causes a failure
|
||||
in test_load_from_stdin_quiet() because it expects empty string.
|
||||
|
||||
This commit makes it to use yaml.safe_load instead of yaml.load. Because
|
||||
it doesn't show the deprecation warnings.
|
||||
|
||||
[0] https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
|
||||
|
||||
Closes: #234
|
||||
---
|
||||
stestr/scheduler.py | 2 +-
|
||||
stestr/tests/test_scheduler.py | 12 ++++++------
|
||||
stestr/tests/test_user_config.py | 8 +++++---
|
||||
stestr/user_config.py | 2 +-
|
||||
4 files changed, 13 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/stestr/scheduler.py b/stestr/scheduler.py
|
||||
index 71a4468..b7c5631 100644
|
||||
--- a/stestr/scheduler.py
|
||||
+++ b/stestr/scheduler.py
|
||||
@@ -155,7 +155,7 @@ def generate_worker_partitions(ids, worker_path, repository=None,
|
||||
:returns: A list where each element is a distinct subset of test_ids.
|
||||
"""
|
||||
with open(worker_path, 'r') as worker_file:
|
||||
- workers_desc = yaml.load(worker_file.read())
|
||||
+ workers_desc = yaml.safe_load(worker_file.read())
|
||||
worker_groups = []
|
||||
for worker in workers_desc:
|
||||
if isinstance(worker, dict) and 'worker' in worker.keys():
|
||||
diff --git a/stestr/tests/test_scheduler.py b/stestr/tests/test_scheduler.py
|
||||
index 2df3593..5959759 100644
|
||||
--- a/stestr/tests/test_scheduler.py
|
||||
+++ b/stestr/tests/test_scheduler.py
|
||||
@@ -124,7 +124,7 @@ def test_generate_worker_partitions(self):
|
||||
{'worker': ['test_']},
|
||||
{'worker': ['test']},
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
groups = scheduler.generate_worker_partitions(test_ids, 'fakepath')
|
||||
expected_grouping = [
|
||||
['test_a', 'test_b'],
|
||||
@@ -139,7 +139,7 @@ def test_generate_worker_partitions_group_without_list(self):
|
||||
{'worker': ['test_']},
|
||||
{'worker': 'test'},
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
self.assertRaises(TypeError, scheduler.generate_worker_partitions,
|
||||
test_ids, 'fakepath')
|
||||
|
||||
@@ -150,7 +150,7 @@ def test_generate_worker_partitions_no_worker_tag(self):
|
||||
{'worker-foo': ['test_']},
|
||||
{'worker': ['test']},
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
self.assertRaises(TypeError, scheduler.generate_worker_partitions,
|
||||
test_ids, 'fakepath')
|
||||
|
||||
@@ -162,7 +162,7 @@ def test_generate_worker_partitions_group_without_match(self):
|
||||
{'worker': ['test']},
|
||||
{'worker': ['foo']}
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
groups = scheduler.generate_worker_partitions(test_ids, 'fakepath')
|
||||
expected_grouping = [
|
||||
['test_a', 'test_b'],
|
||||
@@ -178,7 +178,7 @@ def test_generate_worker_partitions_with_count(self):
|
||||
{'worker': ['test']},
|
||||
{'worker': ['a_thing'], 'concurrency': 2},
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
groups = scheduler.generate_worker_partitions(test_ids, 'fakepath')
|
||||
expected_grouping = [
|
||||
['test_a', 'test_b'],
|
||||
@@ -196,7 +196,7 @@ def test_generate_worker_partitions_with_count_1(self):
|
||||
{'worker': ['test_']},
|
||||
{'worker': ['test'], 'count': 1},
|
||||
]
|
||||
- with mock.patch('yaml.load', return_value=fake_worker_yaml):
|
||||
+ with mock.patch('yaml.safe_load', return_value=fake_worker_yaml):
|
||||
groups = scheduler.generate_worker_partitions(test_ids, 'fakepath')
|
||||
expected_grouping = [
|
||||
['test_a', 'test_b'],
|
||||
diff --git a/stestr/tests/test_user_config.py b/stestr/tests/test_user_config.py
|
||||
index 2758f76..ef329a2 100644
|
||||
--- a/stestr/tests/test_user_config.py
|
||||
+++ b/stestr/tests/test_user_config.py
|
||||
@@ -96,13 +96,14 @@ def fake_isfile(path):
|
||||
user_config.get_user_config()
|
||||
user_mock.assert_called_once_with(self.home_path)
|
||||
|
||||
- @mock.patch('yaml.load', return_value={})
|
||||
+ @mock.patch('yaml.safe_load', return_value={})
|
||||
@mock.patch('six.moves.builtins.open', mock.mock_open())
|
||||
def test_user_config_empty_schema(self, yaml_mock):
|
||||
user_conf = user_config.UserConfig('/path')
|
||||
self.assertEqual({}, user_conf.config)
|
||||
|
||||
- @mock.patch('yaml.load', return_value={'init': {'subunit-trace': True}})
|
||||
+ @mock.patch('yaml.safe_load',
|
||||
+ return_value={'init': {'subunit-trace': True}})
|
||||
@mock.patch('sys.exit')
|
||||
@mock.patch('six.moves.builtins.open', mock.mock_open())
|
||||
def test_user_config_invalid_command(self, exit_mock, yaml_mock):
|
||||
@@ -111,7 +112,8 @@ def test_user_config_invalid_command(self, exit_mock, yaml_mock):
|
||||
"extra keys not allowed @ data['init']")
|
||||
exit_mock.assert_called_once_with(error_string)
|
||||
|
||||
- @mock.patch('yaml.load', return_value={'run': {'subunit-trace': True}})
|
||||
+ @mock.patch('yaml.safe_load',
|
||||
+ return_value={'run': {'subunit-trace': True}})
|
||||
@mock.patch('sys.exit')
|
||||
@mock.patch('six.moves.builtins.open', mock.mock_open())
|
||||
def test_user_config_invalid_option(self, exit_mock, yaml_mock):
|
||||
diff --git a/stestr/user_config.py b/stestr/user_config.py
|
||||
index c54be1b..02ef026 100644
|
||||
--- a/stestr/user_config.py
|
||||
+++ b/stestr/user_config.py
|
||||
@@ -66,7 +66,7 @@ def __init__(self, path):
|
||||
}
|
||||
})
|
||||
with open(path, 'r') as fd:
|
||||
- self.config = yaml.load(fd.read())
|
||||
+ self.config = yaml.safe_load(fd.read())
|
||||
if self.config is None:
|
||||
self.config = {}
|
||||
try:
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2e0c82f860db36ac9f6554189b3b51f5422c7d233d7474a01bced9eecdf436b8
|
||||
size 106709
|
3
stestr-2.4.0.tar.gz
Normal file
3
stestr-2.4.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3cd46043174acf900f521e68b53d0915fa4bd6b4d8be2a2ad2ee98c4a4d7d2ae
|
||||
size 98963
|
Reference in New Issue
Block a user