summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Mewett <tom.mewett@codethink.co.uk>2019-08-21 16:55:13 +0100
committerJürg Billeter <j@bitron.ch>2019-08-30 09:02:04 +0200
commit1ba9d99936e9ad2043f74941b5fdb5f259732b18 (patch)
treec635f64a4998f655bdd4dd70bcb329c8acca3664
parent93e7fc5f6299b7fbb86b8a106859d1c094cfb588 (diff)
downloadbuildstream-1ba9d99936e9ad2043f74941b5fdb5f259732b18.tar.gz
tests/internals/storage_vdir_import.py: Reduce number of test cases
In changing the tests to use in_subprocess, they were modified to do parametrization over both variables instead of looping over one in the test itself. The purpose of the original code was to reduce the number of test cases printed in the output. I have hence attempted to remove superfluous test cases.
-rw-r--r--tests/internals/storage_vdir_import.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/internals/storage_vdir_import.py b/tests/internals/storage_vdir_import.py
index 4599d4d5d..8fbf4142f 100644
--- a/tests/internals/storage_vdir_import.py
+++ b/tests/internals/storage_vdir_import.py
@@ -40,19 +40,14 @@ from buildstream.storage.directory import VirtualDirectoryError
root_filesets = [
[('a/b/c/textfile1', 'F', 'This is textfile 1\n')],
[('a/b/c/textfile1', 'F', 'This is the replacement textfile 1\n')],
- [('a/b/d', 'D', '')],
- [('a/b/e', 'S', '/a/b/d')],
[('a/b/f', 'S', '/a/b/c')],
- [('a/b/d', 'D', ''), ('a/b/e', 'S', '/a/b/d')],
[('a/b/c', 'D', ''), ('a/b/f', 'S', '/a/b/c')],
- [('a/c', 'F', 'This is textfile 1\n')],
- [('a/b/e', 'F', 'This is textfile 1\n')],
- [('a/b/c', 'D', '')]
+ [('a/b/f', 'F', 'This is textfile 1\n')],
]
empty_hash_ref = sha256().hexdigest()
RANDOM_SEED = 69105
-NUM_RANDOM_TESTS = 10
+NUM_RANDOM_TESTS = 4
def generate_import_roots(rootno, directory):
@@ -269,14 +264,14 @@ def _listing_test(tmpdir, root, generator_function):
cas_cache.release_resources()
-@pytest.mark.parametrize("root", range(1, 11))
@pytest.mark.in_subprocess
+@pytest.mark.parametrize("root", range(1, NUM_RANDOM_TESTS + 1))
def test_random_directory_listing(tmpdir, root):
_listing_test(str(tmpdir), root, generate_random_root)
-@pytest.mark.parametrize("root", [1, 2, 3, 4, 5])
@pytest.mark.in_subprocess
+@pytest.mark.parametrize("root", range(1, len(root_filesets) + 1))
def test_fixed_directory_listing(tmpdir, root):
_listing_test(str(tmpdir), root, generate_import_roots)