diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-05-11 00:40:48 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-05-11 00:40:51 -0400 |
commit | 709b437ffe4d7f03ea794062d9e1b9366826a1db (patch) | |
tree | 6978af663496f1f9ec2e234dfee94353061240d5 | |
parent | 8cdfaacd3c1cf4a1ecb15562934086a5b89a888b (diff) | |
download | delivery_merge-709b437ffe4d7f03ea794062d9e1b9366826a1db.tar.gz |
Improve tests
-rw-r--r-- | tests/__init__.py | 0 | ||||
-rw-r--r-- | tests/test_conda.py | 1 | ||||
-rw-r--r-- | tests/test_merge.py | 16 | ||||
-rw-r--r-- | tests/test_utils.py | 9 |
4 files changed, 14 insertions, 12 deletions
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/test_conda.py b/tests/test_conda.py index 6dfa4de..d9db7d1 100644 --- a/tests/test_conda.py +++ b/tests/test_conda.py @@ -1,5 +1,4 @@ import os -import pytest from delivery_merge import conda diff --git a/tests/test_merge.py b/tests/test_merge.py index 1b919f7..469bd4d 100644 --- a/tests/test_merge.py +++ b/tests/test_merge.py @@ -75,8 +75,8 @@ class TestMerge: self.prefix = conda.conda_installer(self.version) conda.conda_init_path(self.prefix) conda.conda('create', '-q', '-y', - '-n', self.env_name, - '--file', self.input_file_base_spec) + '-n', self.env_name, + '--file', self.input_file_base_spec) def teardown_class(self): pass @@ -105,7 +105,8 @@ class TestMerge: input_data = merge.dmfile(self.input_file) output_data = conda.conda(f'list -n {self.env_name}') output_data.check_returncode() - installed = [x.split()[0] for x in output_data.stdout.decode().splitlines() + installed = [x.split()[0] + for x in output_data.stdout.decode().splitlines() if not x.startswith('#')] requested = [x['name'] for x in input_data] for req in requested: @@ -122,7 +123,8 @@ class TestMerge: def test_integration_test(self): merge.env_combine(self.input_file, self.env_name, CHANNELS) - input_data = list(merge.testable_packages(self.input_file, self.prefix)) + input_data = list(merge.testable_packages(self.input_file, + self.prefix)) assert input_data output_dir = 'test_results' @@ -131,3 +133,9 @@ class TestMerge: assert os.path.exists(result) contents = open(result).read() assert contents.startswith('<?xml') and contents.endswith('</testsuite>') + + def test_force_xunit2(self): + assert not os.path.exists('pytest.ini') + merge.force_xunit2() + assert os.path.exists('pytest.ini') + assert 'junit_family = xunit2' in open('pytest.ini').read() diff --git a/tests/test_utils.py b/tests/test_utils.py index f4eceb5..f51ea03 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,5 +1,4 @@ import os -import pytest from delivery_merge import utils @@ -46,10 +45,6 @@ class TestUtils: result = utils.getenv("INFINITE_FUN=LINE=10") assert result.get('INFINITE_FUN') == 'LINE=10' - def test_getenv_multi_equal(self): - result = utils.getenv("INFINITE_FUN=LINE=10") - assert result.get('INFINITE_FUN') == 'LINE=10' - def test_pushd(self): orig_path = os.path.abspath('.') d = os.path.join(orig_path, 'pushd_test') @@ -58,7 +53,7 @@ class TestUtils: os.mkdir(d) with utils.pushd(d): - new_path = os.path.abspath('.') - assert new_path == os.path.join(orig_path, d) + new_path = os.path.abspath('.') + assert new_path == os.path.join(orig_path, d) assert os.path.abspath('.') == orig_path |