summaryrefslogtreecommitdiffstats
path: root/tests/test_wrapper.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2026-04-03 22:47:28 -0400
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2026-04-06 11:15:58 -0700
commitac2be4c089fda58b9ba2f7b2bdb1416f8d3a74b2 (patch)
treefee7bc82e981ba72337deb32b08d48b1be643fd8 /tests/test_wrapper.py
parent3d819e8e3ec49a2f44274aed8aa7eb4736df9b5f (diff)
downloadgit-repo-ac2be4c089fda58b9ba2f7b2bdb1416f8d3a74b2.tar.gz
tests: convert __file__ usage to pathlib
Change-Id: I2408b0ac97629f0d5fc92779b78bf1ff159a6f83 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/569442 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_wrapper.py')
-rw-r--r--tests/test_wrapper.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py
index 89d8b2385..7845ee163 100644
--- a/tests/test_wrapper.py
+++ b/tests/test_wrapper.py
@@ -209,11 +209,12 @@ class Requirements(RepoWrapperTestCase):
209 209
210 def test_missing_file(self): 210 def test_missing_file(self):
211 """Don't crash if the file is missing (old version).""" 211 """Don't crash if the file is missing (old version)."""
212 testdir = os.path.dirname(os.path.realpath(__file__)) 212 self.assertIsNone(
213 self.assertIsNone(self.wrapper.Requirements.from_dir(testdir)) 213 self.wrapper.Requirements.from_dir(utils_for_test.THIS_DIR)
214 )
214 self.assertIsNone( 215 self.assertIsNone(
215 self.wrapper.Requirements.from_file( 216 self.wrapper.Requirements.from_file(
216 os.path.join(testdir, "xxxxxxxxxxxxxxxxxxxxxxxx") 217 utils_for_test.THIS_DIR / "xxxxxxxxxxxxxxxxxxxxxxxx"
217 ) 218 )
218 ) 219 )
219 220
@@ -225,12 +226,10 @@ class Requirements(RepoWrapperTestCase):
225 def test_valid_data(self): 226 def test_valid_data(self):
226 """Make sure we can parse the file we ship.""" 227 """Make sure we can parse the file we ship."""
227 self.assertIsNotNone(self.wrapper.Requirements.from_data(b"{}")) 228 self.assertIsNotNone(self.wrapper.Requirements.from_data(b"{}"))
228 rootdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 229 rootdir = utils_for_test.THIS_DIR.parent
229 self.assertIsNotNone(self.wrapper.Requirements.from_dir(rootdir)) 230 self.assertIsNotNone(self.wrapper.Requirements.from_dir(rootdir))
230 self.assertIsNotNone( 231 self.assertIsNotNone(
231 self.wrapper.Requirements.from_file( 232 self.wrapper.Requirements.from_file(rootdir / "requirements.json")
232 os.path.join(rootdir, "requirements.json")
233 )
234 ) 233 )
235 234
236 def test_format_ver(self): 235 def test_format_ver(self):