2121import  unittest 
2222from  pathlib  import  Path 
2323
24- from  rules_python . python .runfiles  import  runfiles 
24+ from  python .runfiles  import  runfiles 
2525
2626
2727class  PipRepositoryAnnotationsTest (unittest .TestCase ):
@@ -34,11 +34,7 @@ def wheel_pkg_dir(self) -> str:
3434
3535    def  test_build_content_and_data (self ):
3636        r  =  runfiles .Create ()
37-         rpath  =  r .Rlocation (
38-             "pip_repository_annotations_example/external/{}/generated_file.txt" .format (
39-                 self .wheel_pkg_dir ()
40-             )
41-         )
37+         rpath  =  r .Rlocation ("{}/generated_file.txt" .format (self .wheel_pkg_dir ()))
4238        generated_file  =  Path (rpath )
4339        self .assertTrue (generated_file .exists ())
4440
@@ -47,11 +43,7 @@ def test_build_content_and_data(self):
4743
4844    def  test_copy_files (self ):
4945        r  =  runfiles .Create ()
50-         rpath  =  r .Rlocation (
51-             "pip_repository_annotations_example/external/{}/copied_content/file.txt" .format (
52-                 self .wheel_pkg_dir ()
53-             )
54-         )
46+         rpath  =  r .Rlocation ("{}/copied_content/file.txt" .format (self .wheel_pkg_dir ()))
5547        copied_file  =  Path (rpath )
5648        self .assertTrue (copied_file .exists ())
5749
@@ -61,7 +53,7 @@ def test_copy_files(self):
6153    def  test_copy_executables (self ):
6254        r  =  runfiles .Create ()
6355        rpath  =  r .Rlocation (
64-             "pip_repository_annotations_example/external/ {}/copied_content/executable{}" .format (
56+             "{}/copied_content/executable{}" .format (
6557                self .wheel_pkg_dir (),
6658                ".exe"  if  platform .system () ==  "windows"  else  ".py" ,
6759            )
@@ -82,7 +74,7 @@ def test_data_exclude_glob(self):
8274        current_wheel_version  =  "0.38.4" 
8375
8476        r  =  runfiles .Create ()
85-         dist_info_dir  =  "pip_repository_annotations_example/external/ {}/site-packages/wheel-{}.dist-info" .format (
77+         dist_info_dir  =  "{}/site-packages/wheel-{}.dist-info" .format (
8678            self .wheel_pkg_dir (),
8779            current_wheel_version ,
8880        )
@@ -113,11 +105,8 @@ def test_extra(self):
113105        # This test verifies that annotations work correctly for pip packages with extras 
114106        # specified, in this case requests[security]. 
115107        r  =  runfiles .Create ()
116-         rpath  =  r .Rlocation (
117-             "pip_repository_annotations_example/external/{}/generated_file.txt" .format (
118-                 self .requests_pkg_dir ()
119-             )
120-         )
108+         path  =  "{}/generated_file.txt" .format (self .requests_pkg_dir ())
109+         rpath  =  r .Rlocation (path )
121110        generated_file  =  Path (rpath )
122111        self .assertTrue (generated_file .exists ())
123112
0 commit comments