def testArtifactsDependencies(self):
    """Check artifact dependencies work."""
    artifact_reg = artifact_registry.REGISTRY

    art_obj = artifact_reg.GetArtifact("TestAggregationArtifactDeps")
    deps = art_obj.GetArtifactDependencies()
    self.assertItemsEqual(list(deps), ["TestAggregationArtifact"])

    deps = art_obj.GetArtifactDependencies(recursive=True)
    self.assertItemsEqual(list(deps),
                          ["TestOSAgnostic", "TestCmdArtifact",
                           "TestAggregationArtifact"])

    # Test recursive loop.
    # Make sure we use the registry registered version of the class.
    source = art_obj.sources[0]
    backup = source.attributes["names"]
    try:
      source.attributes["names"] = ["TestAggregationArtifactDeps"]
      with self.assertRaises(RuntimeError) as e:
        deps = art_obj.GetArtifactDependencies(recursive=True)
      self.assertTrue("artifact recursion depth" in e.exception.message)
    finally:
      source.attributes["names"] = backup   # Restore old source.
dataset/ETHPy150Open google/grr/grr/lib/artifact_utils_test.py/ArtifactHandlingTest.testArtifactsDependencies/original