11import os
22import unittest
33
4- from tests2 . base import TOP_LEVEL , TestZstash , run_cmd
4+ from tests_integration . utils import TestZstash , run_cmd
55
66
77class TestCacheFs (TestZstash ):
@@ -17,7 +17,7 @@ def test_hpss_none_fs_on(self):
1717 # internal symlink (in same dir, in different dir), external symlink
1818 # internal hard link (in same dir, in different dir), external hard link, broken hard link
1919 self .setup_dirs (include_broken_symlink = False )
20- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
20+ os .chdir (f"{ self .work_dir } /zstash_src/" )
2121
2222 # Test zstash_src before create
2323 self .assertTrue (os .path .islink ("file0_soft.txt" ))
@@ -28,10 +28,10 @@ def test_hpss_none_fs_on(self):
2828 self .assertFalse (os .path .islink ("file_not_included_hard.txt" ))
2929 self .assertFalse (os .path .islink ("original_was_deleted_hard.txt" ))
3030
31- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /" )
32- cmd = f"zstash create --hpss=none --cache={ TOP_LEVEL } / { self .work_dir } /test_cache --follow-symlinks zstash_src"
31+ os .chdir (f"{ self .work_dir } /" )
32+ cmd = f"zstash create --hpss=none --cache={ self .work_dir } /test_cache --follow-symlinks zstash_src"
3333 run_cmd (cmd )
34- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
34+ os .chdir (f"{ self .work_dir } /zstash_src/" )
3535
3636 # Test zstash_src after create
3737 # Running `create` should not alter the source directory.
@@ -44,9 +44,7 @@ def test_hpss_none_fs_on(self):
4444 self .assertFalse (os .path .islink ("original_was_deleted_hard.txt" ))
4545
4646 os .chdir ("../zstash_extracted" )
47- cmd = (
48- f"zstash extract --hpss=none --cache={ TOP_LEVEL } /{ self .work_dir } /test_cache"
49- )
47+ cmd = f"zstash extract --hpss=none --cache={ self .work_dir } /test_cache"
5048 run_cmd (cmd )
5149
5250 # Test extraction from zstash_archive
@@ -81,24 +79,22 @@ def test_hpss_none_fs_on_broken_symlink(self):
8179 # Cases:
8280 # broken symlink
8381 self .setup_dirs (include_broken_symlink = True )
84- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
82+ os .chdir (f"{ self .work_dir } /zstash_src/" )
8583
8684 # Test zstash_src before create
8785 self .assertTrue (os .path .islink ("original_was_deleted_soft.txt" ))
8886
89- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /" )
90- cmd = f"zstash create --hpss=none --cache={ TOP_LEVEL } / { self .work_dir } /test_cache --follow-symlinks zstash_src"
87+ os .chdir (f"{ self .work_dir } /" )
88+ cmd = f"zstash create --hpss=none --cache={ self .work_dir } /test_cache --follow-symlinks zstash_src"
9189 run_cmd (cmd )
92- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
90+ os .chdir (f"{ self .work_dir } /zstash_src/" )
9391
9492 # Test zstash_src after create
9593 # Running `create` should not alter the source directory.
9694 self .assertTrue (os .path .islink ("original_was_deleted_soft.txt" ))
9795
9896 os .chdir ("../zstash_extracted" )
99- cmd = (
100- f"zstash extract --hpss=none --cache={ TOP_LEVEL } /{ self .work_dir } /test_cache"
101- )
97+ cmd = f"zstash extract --hpss=none --cache={ self .work_dir } /test_cache"
10298 _ , err = run_cmd (cmd )
10399 # This is ultimately caused by:
104100 # `Exception: Archive creation failed due to broken symlink.`
@@ -111,7 +107,7 @@ def test_hpss_none_fs_on_broken_symlink(self):
111107 def test_hpss_none_fs_off (self ):
112108 #
113109 self .setup_dirs (include_broken_symlink = False )
114- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
110+ os .chdir (f"{ self .work_dir } /zstash_src/" )
115111
116112 # Test zstash_src before create
117113 self .assertTrue (os .path .islink ("file0_soft.txt" ))
@@ -122,10 +118,10 @@ def test_hpss_none_fs_off(self):
122118 self .assertFalse (os .path .islink ("file_not_included_hard.txt" ))
123119 self .assertFalse (os .path .islink ("original_was_deleted_hard.txt" ))
124120
125- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /" )
126- cmd = f"zstash create --hpss=none --cache={ TOP_LEVEL } / { self .work_dir } /test_cache zstash_src"
121+ os .chdir (f"{ self .work_dir } /" )
122+ cmd = f"zstash create --hpss=none --cache={ self .work_dir } /test_cache zstash_src"
127123 run_cmd (cmd )
128- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
124+ os .chdir (f"{ self .work_dir } /zstash_src/" )
129125
130126 # Test zstash_src after create
131127 # Running `create` should not alter the source directory.
@@ -138,9 +134,7 @@ def test_hpss_none_fs_off(self):
138134 self .assertFalse (os .path .islink ("original_was_deleted_hard.txt" ))
139135
140136 os .chdir ("../zstash_extracted" )
141- cmd = (
142- f"zstash extract --hpss=none --cache={ TOP_LEVEL } /{ self .work_dir } /test_cache"
143- )
137+ cmd = f"zstash extract --hpss=none --cache={ self .work_dir } /test_cache"
144138 run_cmd (cmd )
145139
146140 # Test extraction from zstash_archive
@@ -172,24 +166,22 @@ def test_hpss_none_fs_off(self):
172166
173167 def test_hpss_none_fs_off_broken_symlink (self ):
174168 self .setup_dirs (include_broken_symlink = True )
175- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
169+ os .chdir (f"{ self .work_dir } /zstash_src/" )
176170
177171 # Test zstash_src before create
178172 self .assertTrue (os .path .islink ("original_was_deleted_soft.txt" ))
179173
180- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /" )
181- cmd = f"zstash create --hpss=none --cache={ TOP_LEVEL } / { self .work_dir } /test_cache zstash_src"
174+ os .chdir (f"{ self .work_dir } /" )
175+ cmd = f"zstash create --hpss=none --cache={ self .work_dir } /test_cache zstash_src"
182176 run_cmd (cmd )
183- os .chdir (f"{ TOP_LEVEL } / { self .work_dir } /zstash_src/" )
177+ os .chdir (f"{ self .work_dir } /zstash_src/" )
184178
185179 # Test zstash_src after create
186180 # Running `create` should not alter the source directory.
187181 self .assertTrue (os .path .islink ("original_was_deleted_soft.txt" ))
188182
189183 os .chdir ("../zstash_extracted" )
190- cmd = (
191- f"zstash extract --hpss=none --cache={ TOP_LEVEL } /{ self .work_dir } /test_cache"
192- )
184+ cmd = f"zstash extract --hpss=none --cache={ self .work_dir } /test_cache"
193185 run_cmd (cmd )
194186 # With fs off, this command completes successfully.
195187
0 commit comments