diff options
author | Jürg Billeter <j@bitron.ch> | 2018-05-11 16:39:50 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-07-17 07:56:40 +0200 |
commit | 5a7d49dc6e1e5fbb8119e9aa4e7d6c4f098c17fe (patch) | |
tree | 9f322dc3bb006197766a308c095b5558125b7710 /tests/artifactcache | |
parent | e35098d34f7311d1068e1c1528e6b204f7dfb69c (diff) | |
download | buildstream-5a7d49dc6e1e5fbb8119e9aa4e7d6c4f098c17fe.tar.gz |
Remove tar artifact cache
No longer used.
Diffstat (limited to 'tests/artifactcache')
-rw-r--r-- | tests/artifactcache/tar.py | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/tests/artifactcache/tar.py b/tests/artifactcache/tar.py deleted file mode 100644 index ef39be31c..000000000 --- a/tests/artifactcache/tar.py +++ /dev/null @@ -1,82 +0,0 @@ -import os -import tarfile -import tempfile -from contextlib import ExitStack - -import pytest - -from buildstream._artifactcache.tarcache import _Tar -from buildstream import utils, ProgramNotFoundError - - -# Test that it 'works' - this may be equivalent to test_archive_no_tar() -# on some systems. -def test_archive_default(): - with ExitStack() as stack: - src = stack.enter_context(tempfile.TemporaryDirectory()) - tar_dir = stack.enter_context(tempfile.TemporaryDirectory()) - scratch = stack.enter_context(tempfile.TemporaryDirectory()) - test_file = stack.enter_context(open(os.path.join(src, 'test'), 'a')) - test_file.write('Test') - - _Tar.archive(os.path.join(tar_dir, 'test.tar'), '.', src) - - with tarfile.open(os.path.join(tar_dir, 'test.tar')) as tar: - tar.extractall(path=scratch) - - assert os.listdir(scratch) == os.listdir(src) - - -def test_archive_no_tar(): - # Modify the path to exclude 'tar' - old_path = os.environ.get('PATH') - os.environ['PATH'] = '' - - # Ensure we can't find 'tar' or 'gtar' - try: - for tar in ['gtar', 'tar']: - with pytest.raises(ProgramNotFoundError): - utils.get_host_tool(tar) - - # Run the same test as before, this time 'tar' should not be available - test_archive_default() - - # Reset the environment - finally: - os.environ['PATH'] = old_path - - -# Same thing as test_archive_default() -def test_extract_default(): - with ExitStack() as stack: - src = stack.enter_context(tempfile.TemporaryDirectory()) - tar_dir = stack.enter_context(tempfile.TemporaryDirectory()) - scratch = stack.enter_context(tempfile.TemporaryDirectory()) - test_file = stack.enter_context(open(os.path.join(src, 'test'), 'a')) - test_file.write('Test') - - with tarfile.open(os.path.join(tar_dir, 'test.tar'), 'a:') as tar: - tar.add(src, 'contents') - - _Tar.extract(os.path.join(tar_dir, 'test.tar'), scratch) - - assert os.listdir(os.path.join(scratch, 'contents')) == os.listdir(src) - - -def test_extract_no_tar(): - # Modify the path to exclude 'tar' - old_path = os.environ.get('PATH') - os.environ['PATH'] = '' - - # Ensure we can't find 'tar' or 'gtar' - for tar in ['gtar', 'tar']: - with pytest.raises(ProgramNotFoundError): - utils.get_host_tool(tar) - - # Run the same test as before, this time 'tar' should not be available - try: - test_extract_default() - - # Reset the environment - finally: - os.environ['PATH'] = old_path |