diff options
author | Chandan Singh <chandan.devel@gmail.com> | 2018-08-15 20:21:01 +0000 |
---|---|---|
committer | Chandan Singh <chandan.devel@gmail.com> | 2018-08-15 20:21:01 +0000 |
commit | d4706096abffe54855269f16261aba06b5fa09b6 (patch) | |
tree | 88e1200a462a66e5893b69ce29a30acb7ff1f30f /tests/sources/previous_source_access.py | |
parent | 1292004636c659769ffa76009539957783aebbc3 (diff) | |
parent | 4a2dd6afe5e04c8f12a2680a09a1225831565731 (diff) | |
download | buildstream-d4706096abffe54855269f16261aba06b5fa09b6.tar.gz |
Merge branch 'chandan/sourcetransform' into 'master'
Allow source plugins to access previous sources
Closes #381
See merge request BuildStream/buildstream!568
Diffstat (limited to 'tests/sources/previous_source_access.py')
-rw-r--r-- | tests/sources/previous_source_access.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/sources/previous_source_access.py b/tests/sources/previous_source_access.py new file mode 100644 index 000000000..f7045383c --- /dev/null +++ b/tests/sources/previous_source_access.py @@ -0,0 +1,47 @@ +import os +import pytest + +from tests.testutils import cli + +DATA_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + 'previous_source_access' +) + + +################################################################## +# Tests # +################################################################## +# Test that plugins can access data from previous sources +@pytest.mark.datafiles(DATA_DIR) +def test_custom_transform_source(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + + # Ensure we can track + result = cli.run(project=project, args=[ + 'track', 'target.bst' + ]) + result.assert_success() + + # Ensure we can fetch + result = cli.run(project=project, args=[ + 'fetch', 'target.bst' + ]) + result.assert_success() + + # Ensure we get correct output from foo_transform + result = cli.run(project=project, args=[ + 'build', 'target.bst' + ]) + destpath = os.path.join(cli.directory, 'checkout') + result = cli.run(project=project, args=[ + 'checkout', 'target.bst', destpath + ]) + result.assert_success() + # Assert that files from both sources exist, and that they have + # the same content + assert os.path.exists(os.path.join(destpath, 'file')) + assert os.path.exists(os.path.join(destpath, 'filetransform')) + with open(os.path.join(destpath, 'file')) as file1: + with open(os.path.join(destpath, 'filetransform')) as file2: + assert file1.read() == file2.read() |