summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Mewett <tom.mewett@codethink.co.uk>2019-08-21 16:55:13 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-08-30 09:28:19 +0000
commitec8b3130fd17fd80369c8e04351e5f7779b0c538 (patch)
tree1e601d5f141396ed0bad655da216511a3994c5d8
parent8b6da7d72637b630bbc06242b9a074ab4dbbe989 (diff)
downloadbuildstream-tmewett/test-in-subprocess.tar.gz
tests/internals/storage_vdir_import.py: Reduce number of test casestmewett/test-in-subprocess
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)