summaryrefslogtreecommitdiff
path: root/tests/sources/generic.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sources/generic.py')
-rw-r--r--tests/sources/generic.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/sources/generic.py b/tests/sources/generic.py
new file mode 100644
index 000000000..6365d8d90
--- /dev/null
+++ b/tests/sources/generic.py
@@ -0,0 +1,28 @@
+import os
+import pathlib
+
+import pytest
+
+from .fixture import Setup
+from buildstream.exceptions import SourceError
+
+# Project directory
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ "generic",
+)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_staging_to_existing(tmpdir, datafiles):
+ setup = Setup(datafiles, 'elements/install-to-build.bst', tmpdir)
+
+ # Create a file in the build directory (/buildstream/build)
+ build_dir = pathlib.Path(os.path.join(setup.context.builddir,
+ 'buildstream', 'build'))
+ build_dir.mkdir(parents=True)
+ build_dir.joinpath('file').touch()
+
+ # Ensure that we can't stage to an already filled build directory
+ with pytest.raises(SourceError):
+ setup.source._stage(setup.context.builddir)