@@ -505,134 +505,6 @@ def testDirectoryBasedRlocationWithRepoMappingFromOtherRepo(self):
505505 r .Rlocation ("config.json" , "protobuf~3.19.2" ), dir + "/config.json"
506506 )
507507
508- def testPathsFromEnvvars (self ):
509- # Both envvars have a valid value.
510- mf , dr = runfiles ._PathsFrom (
511- "argv0" ,
512- "mock1/MANIFEST" ,
513- "mock2" ,
514- lambda path : path == "mock1/MANIFEST" ,
515- lambda path : path == "mock2" ,
516- )
517- self .assertEqual (mf , "mock1/MANIFEST" )
518- self .assertEqual (dr , "mock2" )
519-
520- # RUNFILES_MANIFEST_FILE is invalid but RUNFILES_DIR is good and there's a
521- # runfiles manifest in the runfiles directory.
522- mf , dr = runfiles ._PathsFrom (
523- "argv0" ,
524- "mock1/MANIFEST" ,
525- "mock2" ,
526- lambda path : path == "mock2/MANIFEST" ,
527- lambda path : path == "mock2" ,
528- )
529- self .assertEqual (mf , "mock2/MANIFEST" )
530- self .assertEqual (dr , "mock2" )
531-
532- # RUNFILES_MANIFEST_FILE is invalid but RUNFILES_DIR is good, but there's no
533- # runfiles manifest in the runfiles directory.
534- mf , dr = runfiles ._PathsFrom (
535- "argv0" ,
536- "mock1/MANIFEST" ,
537- "mock2" ,
538- lambda path : False ,
539- lambda path : path == "mock2" ,
540- )
541- self .assertEqual (mf , "" )
542- self .assertEqual (dr , "mock2" )
543-
544- # RUNFILES_DIR is invalid but RUNFILES_MANIFEST_FILE is good, and it is in
545- # a valid-looking runfiles directory.
546- mf , dr = runfiles ._PathsFrom (
547- "argv0" ,
548- "mock1/MANIFEST" ,
549- "mock2" ,
550- lambda path : path == "mock1/MANIFEST" ,
551- lambda path : path == "mock1" ,
552- )
553- self .assertEqual (mf , "mock1/MANIFEST" )
554- self .assertEqual (dr , "mock1" )
555-
556- # RUNFILES_DIR is invalid but RUNFILES_MANIFEST_FILE is good, but it is not
557- # in any valid-looking runfiles directory.
558- mf , dr = runfiles ._PathsFrom (
559- "argv0" ,
560- "mock1/MANIFEST" ,
561- "mock2" ,
562- lambda path : path == "mock1/MANIFEST" ,
563- lambda path : False ,
564- )
565- self .assertEqual (mf , "mock1/MANIFEST" )
566- self .assertEqual (dr , "" )
567-
568- # Both envvars are invalid, but there's a manifest in a runfiles directory
569- # next to argv0, however there's no other content in the runfiles directory.
570- mf , dr = runfiles ._PathsFrom (
571- "argv0" ,
572- "mock1/MANIFEST" ,
573- "mock2" ,
574- lambda path : path == "argv0.runfiles/MANIFEST" ,
575- lambda path : False ,
576- )
577- self .assertEqual (mf , "argv0.runfiles/MANIFEST" )
578- self .assertEqual (dr , "" )
579-
580- # Both envvars are invalid, but there's a manifest next to argv0. There's
581- # no runfiles tree anywhere.
582- mf , dr = runfiles ._PathsFrom (
583- "argv0" ,
584- "mock1/MANIFEST" ,
585- "mock2" ,
586- lambda path : path == "argv0.runfiles_manifest" ,
587- lambda path : False ,
588- )
589- self .assertEqual (mf , "argv0.runfiles_manifest" )
590- self .assertEqual (dr , "" )
591-
592- # Both envvars are invalid, but there's a valid manifest next to argv0, and
593- # a valid runfiles directory (without a manifest in it).
594- mf , dr = runfiles ._PathsFrom (
595- "argv0" ,
596- "mock1/MANIFEST" ,
597- "mock2" ,
598- lambda path : path == "argv0.runfiles_manifest" ,
599- lambda path : path == "argv0.runfiles" ,
600- )
601- self .assertEqual (mf , "argv0.runfiles_manifest" )
602- self .assertEqual (dr , "argv0.runfiles" )
603-
604- # Both envvars are invalid, but there's a valid runfiles directory next to
605- # argv0, though no manifest in it.
606- mf , dr = runfiles ._PathsFrom (
607- "argv0" ,
608- "mock1/MANIFEST" ,
609- "mock2" ,
610- lambda path : False ,
611- lambda path : path == "argv0.runfiles" ,
612- )
613- self .assertEqual (mf , "" )
614- self .assertEqual (dr , "argv0.runfiles" )
615-
616- # Both envvars are invalid, but there's a valid runfiles directory next to
617- # argv0 with a valid manifest in it.
618- mf , dr = runfiles ._PathsFrom (
619- "argv0" ,
620- "mock1/MANIFEST" ,
621- "mock2" ,
622- lambda path : path == "argv0.runfiles/MANIFEST" ,
623- lambda path : path == "argv0.runfiles" ,
624- )
625- self .assertEqual (mf , "argv0.runfiles/MANIFEST" )
626- self .assertEqual (dr , "argv0.runfiles" )
627-
628- # Both envvars are invalid and there's no runfiles directory or manifest
629- # next to the argv0.
630- mf , dr = runfiles ._PathsFrom (
631- "argv0" , "mock1/MANIFEST" , "mock2" , lambda path : False , lambda path : False
632- )
633- self .assertEqual (mf , "" )
634- self .assertEqual (dr , "" )
635-
636508 def testCurrentRepository (self ):
637509 # This test assumes that it is running without --enable_bzlmod as the
638510 # correct result with Bzlmod would be the empty string - the canonical
0 commit comments