Update Tests:

* don't use the project fixtures anymore but the one Django project
* update and refactor cache tests to be less brittle
* explicitly test mysql, postgresql and sqlite3 databases
* remove 'multiple_call' tests since it is not possible anymore
(with the Django singleton)
* update Travis and tox (dropping Python 3.4)
This commit is contained in:
David Wobrock committed 2019-05-12 15:32:57 +02:00
1 parent f35c9177f4
commit 5390fd507f
9 files changed
+303 -668

No files matched your search

+11 -63
View File
@@ -13,70 +13,18 @@
# limitations under the License.
import os
import shutil
_BASE_DIR = os.path.join(
_PROJ_TEST_DIR = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'tests/')
_FIXTURES_FOLDER = os.path.join(_BASE_DIR, 'test_project_fixtures/')
ADD_NOT_NULL_COLUMN_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_add_not_null_column/')
CREATE_TABLE_WITH_NOT_NULL_COLUMN_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_create_table_with_not_null_column/')
DROP_COLUMN_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_drop_column/')
RENAME_COLUMN_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_rename_column/')
ALTER_COLUMN_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_alter_column')
RENAME_TABLE_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_rename_table/')
ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_add_not_null_column_followed_by_default/')
MULTI_COMMIT_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_multi_commit/')
CORRECT_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_correct_project/')
DELETED_MIGRATION_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_deleted_migration_project/')
IGNORE_MIGRATION_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_project_ignore_migration/')
NOT_DJANGO_GIT_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_git_project/')
NOT_GIT_DJANGO_PROJECT = os.path.join(
_FIXTURES_FOLDER, 'test_django_without_git_project/')
NON_GIT_ROOT_GIT_FOLDER = os.path.join(
_FIXTURES_FOLDER, 'test_non_root_git_project/'
)
NON_GIT_ROOT_DJANGO_PROJECT = os.path.join(
NON_GIT_ROOT_GIT_FOLDER, 'django_project/'
"tests/",
"test_project",
)
ALL_GIT_PROJECTS = (
NOT_DJANGO_GIT_PROJECT,
MULTI_COMMIT_PROJECT,
DELETED_MIGRATION_PROJECT,
NON_GIT_ROOT_GIT_FOLDER,
)
def prepare_git_project(path):
"""Copy the git/ folder to .git/ so it is
actually versioned"""
src_git = os.path.join(path, 'git/')
dest_git = os.path.join(path, '.git/')
try:
shutil.copytree(src_git, dest_git)
except OSError:
pass # .git/ might already exist
def clear_all_git_projects():
"""Delete all .git/ folders in test projects"""
for project_path in ALL_GIT_PROJECTS:
git_path = os.path.join(project_path, '.git/')
shutil.rmtree(git_path, ignore_errors=True)
CREATE_TABLE_WITH_NOT_NULL_COLUMN = "app_create_table_with_not_null_column"
ADD_NOT_NULL_COLUMN = "app_add_not_null_column"
DROP_COLUMN = "app_drop_column"
RENAME_COLUMN = "app_rename_column"
RENAME_TABLE = "app_rename_table"
IGNORE_MIGRATION = "app_ignore_migration"
ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT = "app_add_not_null_column_followed_by_default"
ALTER_COLUMN = "app_alter_column"