summaryrefslogtreecommitdiff
path: root/tests/sources/local.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sources/local.py')
-rw-r--r--tests/sources/local.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/sources/local.py b/tests/sources/local.py
index 4fe941b35..bfddf6881 100644
--- a/tests/sources/local.py
+++ b/tests/sources/local.py
@@ -55,6 +55,32 @@ def test_stage_directory(cli, tmpdir, datafiles):
assert(os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt')))
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'symlink'))
+def test_stage_symlink(cli, tmpdir, datafiles):
+
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ checkoutdir = os.path.join(str(tmpdir), "checkout")
+
+ # Workaround datafiles bug:
+ #
+ # https://github.com/omarkohl/pytest-datafiles/issues/1
+ #
+ # Create the symlink by hand.
+ symlink = os.path.join(project, 'files', 'symlink-to-file.txt')
+ os.symlink('file.txt', symlink)
+
+ # Build, checkout
+ result = cli.run(project=project, args=['build', 'target.bst'])
+ result.assert_success()
+ result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir])
+ result.assert_success()
+
+ # Check that the checkout contains the expected file and directory and other file
+ assert(os.path.exists(os.path.join(checkoutdir, 'file.txt')))
+ assert(os.path.exists(os.path.join(checkoutdir, 'symlink-to-file.txt')))
+ assert(os.path.islink(os.path.join(checkoutdir, 'symlink-to-file.txt')))
+
+
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'file-exists'))
def test_stage_file_exists(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)