summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-26 18:02:20 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-12-26 18:19:07 -0500
commit50c1bb7f88dad806bff703a19dddf11374aac53e (patch)
tree9993b8eb36d1b71838e245d391d08287c39db0ed
parentc61e17931243d014fda59321e972076d16a263a0 (diff)
downloadbuildstream-50c1bb7f88dad806bff703a19dddf11374aac53e.tar.gz
tests/sources/tar.py: Test that we don't crash when HOME is unset
This happens when the netrc module is searching for a ~/.netrc file and it doesnt find any HOME set.
-rw-r--r--tests/sources/tar.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index dc7c85e80..35eb8375e 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -388,3 +388,19 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir):
result = cli.run(project=project, args=['source', 'track', 'target.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, None)
+
+
+# Test that BuildStream doesnt crash if HOME is unset while
+# the netrc module is trying to find it's ~/.netrc file.
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'fetch'))
+def test_homeless_environment(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ generate_project(project, tmpdir)
+
+ # Create a local tar
+ src_tar = os.path.join(str(tmpdir), "a.tar.gz")
+ _assemble_tar(os.path.join(str(datafiles), "content"), "a", src_tar)
+
+ # Use a track, make sure the plugin tries to find a ~/.netrc
+ result = cli.run(project=project, args=['source', 'track', 'target.bst'], env={'HOME': None})
+ result.assert_success()