From f71e6c70d4a9f0f82b4d64aedc0e2d1bb757354f Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas.kluyver@xfel.eu> Date: Mon, 22 Apr 2024 11:57:07 +0100 Subject: [PATCH] Create an unreadable temp directory for testing --- tests/test_webservice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_webservice.py b/tests/test_webservice.py index feae3c386..74d9d8e0b 100644 --- a/tests/test_webservice.py +++ b/tests/test_webservice.py @@ -49,7 +49,7 @@ INVALID_BEAMTIME = { } @pytest.mark.requires_gpfs -def test_check_files(): +def test_check_files(tmp_path): in_folder = '/gpfs/exfel/exp/CALLAB/202031/p900113/raw' runs = [9985, 9984] karabo_das = ['AGIPD06', 'AGIPD07'] @@ -62,9 +62,10 @@ def test_check_files(): runs = [1, 2] assert not check_files(in_folder, runs, karabo_das) + noaccess = tmp_path / "noaccess" + noaccess.mkdir(mode=0o000) # make a directory we can't read with pytest.raises(PermissionError): - in_folder = '/gpfs/maxwell/home/achilles' # arbitrarily chosen - check_files(in_folder, runs, karabo_das) + check_files(str(noaccess), runs, karabo_das) def test_merge(): -- GitLab