handle linting a project in pwd
When calling "django-migration-linter ." be able to handle it (especially with cache)
This commit is contained in:
1 parent
75c969c6a9
commit
009153fbf4
5 files changed
+30
-3
No files matched your search
@@ -220,3 +220,24 @@ class CallLinterFromCommandLineTest(unittest.TestCase):
|
||||
self.assertEqual(len(lines), 3)
|
||||
self.assertTrue(lines[0].endswith('OK'))
|
||||
self.assertTrue(lines[1].startswith('*** Summary'))
|
||||
|
||||
def test_call_from_within_project(self):
|
||||
cmd = 'cd {0} && {1} --no-cache .'.format(
|
||||
fixtures.CORRECT_PROJECT,
|
||||
self.linter_exec)
|
||||
|
||||
process = Popen(
|
||||
cmd, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
process.wait()
|
||||
self.assertEqual(process.returncode, 0)
|
||||
lines = list(map(utils.clean_bytes_to_str, process.stdout.readlines()))
|
||||
self.assertEqual(len(lines), 6)
|
||||
self.assertEqual(
|
||||
sorted(lines[:4]),
|
||||
sorted([
|
||||
"(test_app1, 0001_initial)... OK",
|
||||
"(test_app1, 0002_a_new_null_field)... OK",
|
||||
"(test_app2, 0001_foo)... OK",
|
||||
"(test_app3, 0001_initial)... OK",
|
||||
])
|
||||
)
|
||||
@@ -58,6 +58,12 @@ class UtilityFunctionTest(unittest.TestCase):
|
||||
self.assertEqual(splitted[1], 'bar')
|
||||
self.assertEqual(splitted[2], 'fuz.py')
|
||||
|
||||
def test_split_folder_path(self):
|
||||
splitted = split_path('/foo/bar')
|
||||
self.assertEqual(len(splitted), 2)
|
||||
self.assertEqual(splitted[0], 'foo')
|
||||
self.assertEqual(splitted[1], 'bar')
|
||||
|
||||
def test_split_migration_long_path(self):
|
||||
input_path = 'apps/the_app/migrations/0001_stuff.py'
|
||||
app, mig = split_migration_path(input_path)
|
||||
|
||||
Reference in new issue
Block a user