示例#1
0
def test_initial_artifact_hash():
    with temprun() as runner:
        filename = "source.txt"

        with open(filename, "w") as f:
            f.write("hello this is some text")

        artifact = InitialArtifact(filename, runner=runner)
        artifact.name = filename
        artifact.run()

        first_hashstring = artifact.hashstring

        time.sleep(1.1)  # make sure mtime is at least 1 second different

        with open(filename, "w") as f:
            f.write("hello this is different text")

        artifact = InitialArtifact(filename, runner=runner)
        artifact.name = filename
        artifact.run()

        second_hashstring = artifact.hashstring

        assert first_hashstring != second_hashstring
示例#2
0
def test_initial_artifact_hash():
    with wrap() as wrapper:
        filename = "source.txt"

        with open(filename, "w") as f:
            f.write("hello this is some text")

        artifact = InitialArtifact(filename, wrapper=wrapper)
        artifact.name = filename
        artifact.run()

        first_hashstring = artifact.hashstring

        time.sleep(1.1) # make sure mtime is at least 1 second different

        with open(filename, "w") as f:
            f.write("hello this is different text")

        artifact = InitialArtifact(filename, wrapper=wrapper)
        artifact.name = filename
        artifact.run()

        second_hashstring = artifact.hashstring

        assert first_hashstring != second_hashstring
示例#3
0
文件: doc.py 项目: tomspur/dexy
    def setup_initial_artifact(self):
        if os.path.exists(self.name):
            initial = InitialArtifact(self.name, runner=self.runner)
        else:
            initial = InitialVirtualArtifact(self.name, runner=self.runner)

        initial.args = self.args
        initial.name = self.name
        initial.prior = None
        initial.doc = self
        initial.created_by_doc = self.created_by_doc

        self.children.append(initial)
        self.artifacts.append(initial)
        self.final_artifact = initial
示例#4
0
文件: doc.py 项目: tomspur/dexy
    def setup_initial_artifact(self):
        if os.path.exists(self.name):
            initial = InitialArtifact(self.name, runner=self.runner)
        else:
            initial = InitialVirtualArtifact(self.name, runner=self.runner)

        initial.args = self.args
        initial.name = self.name
        initial.prior = None
        initial.doc = self
        initial.created_by_doc = self.created_by_doc

        self.children.append(initial)
        self.artifacts.append(initial)
        self.final_artifact = initial