Esempio n. 1
0
    def test_errors_ignored_on_copy(self):
        p = PyCopier(source=None, destination=None, ignoreErrorOnCopy=True)
        with self.getNewDestination() as dest:
            p._copyFile("/fake/file", dest)

        # nothing raised... nothing copied
        assert p.getSkippedCopiesCount() == 0
        assert p.getCopiedDataBytes() == 0
Esempio n. 2
0
    def test_skip_same_looking_file(self):
        p = PyCopier(source=None, destination=None, skipSameLookingFiles=True)
        with self.getNewDestination() as dest:
            shutil.copy2(__file__, dest)
            p._copyFile(__file__, dest)

        assert p.getSkippedCopiesCount() == 1
        assert p.getCopiedDataBytes() == 0
Esempio n. 3
0
    def test_skip_same_looking_file_doesnt_happen_if_meta_doesnt_match(self):
        p = PyCopier(source=None, destination=None, skipSameLookingFiles=True)
        with self.getNewDestination() as dest:
            shutil.copy(__file__, dest)
            p._copyFile(__file__, dest)

        assert p.getSkippedCopiesCount() == 0
        assert p.getCopiedDataBytes() == os.path.getsize(__file__)
Esempio n. 4
0
    def test_generic_copy_file(self):
        p = PyCopier(source=None, destination=None)
        with self.getNewDestination() as dest:
            p._copyFile(__file__, dest)
            assert os.path.isfile(dest)
            assert filecmp.cmp(__file__, dest, shallow=False)

        assert p.getCopiedDataBytes() == os.path.getsize(__file__)
        assert p.getSkippedCopiesCount() == 0