def test_jar_dependency(self): with ParseContext.temp(): org, name = "org", "name" # thing to override nay = JarDependency(org, name, "0.0.1") yea = JarDependency(org, name, "0.0.8") # define targets depend on different 'org:c's JarLibrary("c", [nay]) JarLibrary("b", [yea]) # then depend on those targets transitively, and override to the correct version l = JarLibrary("a", dependencies=[Pants(":c")], overrides=[":b"]) # confirm that resolving includes the correct version resolved = set(l.resolve()) self.assertTrue(yea in resolved) # and attaches an exclude directly to the JarDependency self.assertTrue(Exclude(org, name) in nay.excludes)