Esempio n. 1
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
Esempio n. 2
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