Change git fixtures, do not use submodule or subtree

Just rename git folder when testing and delete them at the end
This commit is contained in:
David-Wobrock committed 2017-11-01 15:28:17 +01:00
1 parent c5fc3ae896
commit 6f84056aeb
434 files changed
+6125 -49

No files matched your search

+38 -39
View File
@@ -19,61 +19,60 @@ from tests import fixtures
class BackwardcompatibilityDetectionTest(unittest.TestCase):
def setUp(self, *args, **kwargs):
return super(
BackwardcompatibilityDetectionTest, self).setUp(*args, **kwargs)
def tearDown(self, *args, **kwargs):
fixtures.clear_all_git_projects()
super(
BackwardcompatibilityDetectionTest,
self).tearDown(*args, **kwargs)
def test_create_table_with_not_null_column(self):
linter = MigrationLinter(
fixtures.CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT)
has_errors = linter.lint_migrations()
self.assertFalse(has_errors)
test_project_path = fixtures.CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_no_errors(test_project_path)
def test_detect_adding_not_null_column(self):
linter = MigrationLinter(
fixtures.ADD_NOT_NULL_COLUMN_PROJECT)
has_errors = linter.lint_migrations()
self.assertTrue(has_errors)
test_project_path = fixtures.ADD_NOT_NULL_COLUMN_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_errors(test_project_path)
def test_detect_drop_column(self):
linter = MigrationLinter(
fixtures.DROP_COLUMN_PROJECT)
has_errors = linter.lint_migrations()
self.assertTrue(has_errors)
test_project_path = fixtures.DROP_COLUMN_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_errors(test_project_path)
def test_detect_rename_column(self):
linter = MigrationLinter(
fixtures.RENAME_COLUMN_PROJECT)
has_errors = linter.lint_migrations()
self.assertTrue(has_errors)
test_project_path = fixtures.RENAME_COLUMN_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_errors(test_project_path)
def test_detect_rename_table(self):
linter = MigrationLinter(
fixtures.RENAME_TABLE_PROJECT)
has_errors = linter.lint_migrations()
self.assertTrue(has_errors)
test_project_path = fixtures.RENAME_TABLE_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_errors(test_project_path)
def test_accept_not_null_column_followed_by_adding_default(self):
linter = MigrationLinter(
fixtures.ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT)
has_errors = linter.lint_migrations()
self.assertFalse(has_errors)
test_project_path = \
fixtures.ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_no_errors(test_project_path)
def test_specify_git_hash(self):
linter = MigrationLinter(
fixtures.MULTI_COMMIT_PROJECT,
commit_id=None)
test_project_path = fixtures.MULTI_COMMIT_PROJECT
fixtures.prepare_git_project(test_project_path)
self._test_linter_finds_errors(test_project_path, commit_id=None)
self._test_linter_finds_no_errors(
test_project_path,
commit_id='44330921696018f8f1480df897b38310549982cb')
self._test_linter_finds_no_errors(test_project_path, commit_id='tag1')
def _test_linter_finds_errors(self, path, commit_id=None):
linter = MigrationLinter(path, commit_id=commit_id)
has_errors = linter.lint_migrations()
self.assertTrue(has_errors)
linter = MigrationLinter(
fixtures.MULTI_COMMIT_PROJECT,
commit_id='44330921696018f8f1480df897b38310549982cb')
has_errors = linter.lint_migrations()
self.assertFalse(has_errors)
linter = MigrationLinter(
fixtures.MULTI_COMMIT_PROJECT,
commit_id='tag1')
def _test_linter_finds_no_errors(self, path, commit_id=None):
linter = MigrationLinter(path, commit_id=commit_id)
has_errors = linter.lint_migrations()
self.assertFalse(has_errors)