Пример #1
0
    def setUp(self):
        _db = getDBConnection('file://test.json')

        with open("test-file.txt", "w") as f:
            f.write("This is a test file.")

        self.artifact = Artifact.registerArtifact(
            name=f'test-artifact',
            typ='text',
            path=f'test-file.txt',
            cwd='./',
            command='echo "This is a test file" > test-file.txt',
            inputs=[],
            documentation=f"This artifact is made for testing.")
Пример #2
0
            return self.db[self.hashes[key]]

    def upload(self, key, path):
        pass

    def downloadFile(self, key, path):
        pass


# Add the MockDB as a scheme
artifact._artifactdb._db_schemes["mockdb"] = MockDB

# This needs to be a global variable so
# that this getDBConnection is the first
# call to create a DB connection
_db = getDBConnection("mockdb://")


class TestGit(unittest.TestCase):
    def test_keys(self):
        git = artifact.artifact.getGit(Path("."))
        self.assertSetEqual(
            set(git.keys()), set(["origin", "hash", "name"]), "git keys wrong"
        )

    def test_origin(self):
        git = artifact.artifact.getGit(Path("."))
        self.assertTrue(
            git["origin"].endswith("gem5art"), "Origin should end with gem5art"
        )
Пример #3
0
            return self.db[self.hashes[key]]

    def upload(self, key, path):
        pass

    def downloadFile(self, key, path):
        pass


# Add the MockDB as a scheme
artifact._artifactdb._db_schemes['mockdb'] = MockDB

# This needs to be a global variable so
# that this getDBConnection is the first
# call to create a DB connection
_db = getDBConnection('mockdb://')


class TestGit(unittest.TestCase):
    def test_keys(self):
        git = artifact.artifact.getGit(Path('.'))
        self.assertSetEqual(set(git.keys()), set(['origin', 'hash', 'name']),
                            "git keys wrong")

    def test_origin(self):
        git = artifact.artifact.getGit(Path('.'))
        self.assertTrue(git['origin'].endswith('gem5art'),
                        "Origin should end with gem5art")


class TestArtifact(unittest.TestCase):
Пример #4
0
            return self.db[key]
        else:
            # This is a hash
            return self.db[self.hashes[key]]

    def upload(self, key, path):
        pass

    def downloadFile(self, key, path):
        pass


# This needs to be a global variable so
# that this getDBConnection is the first
# call to create a DB connection
_db = getDBConnection(typ = MockDB)


class TestGit(unittest.TestCase):
    def test_keys(self):
        git = artifact.artifact.getGit(Path('.'))
        self.assertSetEqual(set(git.keys()), set(['origin', 'hash', 'name']),
                            "git keys wrong")

    def test_origin(self):
        git = artifact.artifact.getGit(Path('.'))
        self.assertTrue(git['origin'].endswith('gem5art'),
                        "Origin should end with gem5art")

class TestArtifact(unittest.TestCase):