Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target_test.py: Use clean paths to avoid failures #1978

Merged
merged 1 commit into from
Jan 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/target_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from helpers import unittest, skipOnTravis
from mock import Mock
import re
import random

import luigi.target
import luigi.format
Expand Down Expand Up @@ -251,23 +252,25 @@ def test_move_on_fs(self):
# We're cheating and retrieving the fs from target.
# TODO: maybe move to "filesystem_test.py" or something
t = self.create_target()
other_path = t.path + '-' + str(random.randint(0, 999999999))
t._touchz()
fs = t.fs
self.assertTrue(t.exists())
fs.move(t.path, t.path+"-yay")
fs.move(t.path, other_path)
self.assertFalse(t.exists())

def test_rename_dont_move_on_fs(self):
# We're cheating and retrieving the fs from target.
# TODO: maybe move to "filesystem_test.py" or something
t = self.create_target()
other_path = t.path + '-' + str(random.randint(0, 999999999))
t._touchz()
fs = t.fs
self.assertTrue(t.exists())
fs.rename_dont_move(t.path, t.path+"-yay")
fs.rename_dont_move(t.path, other_path)
self.assertFalse(t.exists())
self.assertRaises(luigi.target.FileAlreadyExists,
lambda: fs.rename_dont_move(t.path, t.path+"-yay"))
lambda: fs.rename_dont_move(t.path, other_path))


class TemporaryPathTest(unittest.TestCase):
Expand Down