Skip to content
This repository was archived by the owner on Aug 8, 2020. It is now read-only.

Commit 9c819ed

Browse files
author
Tonye Jack
committed
Fixed test.
1 parent 450a311 commit 9c819ed

File tree

8 files changed

+27
-16
lines changed

8 files changed

+27
-16
lines changed

.envrc

-1
This file was deleted.

.envrc.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export ENV_DB=postgres,mysql
1+
export ENV_DB=postgres,mysql,sqlite3

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__/
66
.nox/
77
*.sqlite3
88
status.json
9+
.envrc

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ clean-build: ## Clean project build artifacts.
3232

3333
test:
3434
@echo "Running `$(PYTHON_VERSION)` test..."
35-
@$(MANAGE_PY) test --noinput --failfast
35+
@$(MANAGE_PY) test -v 3 --noinput --failfast
3636

3737
install: clean-build ## Install project dependencies.
3838
@echo "Installing project in dependencies..."

demo/migrations/0002_auto_20200218_0733.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.db import migrations
44

55

6-
def non_null_count(values):
6+
def non_null_count(*values):
77
none_values = [i for i in values if i == None]
88

99
return len(none_values)

demo/migrations/0003_auto_20200222_0146.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ def apply(self, project_state, schema_editor, collect_sql=False):
3333
operation.state_forwards(self.app_label, project_state)
3434
return project_state
3535

36-
return super().apply(project_state, schema_editor, collect_sql=collect_sql)
36+
return super(Migration, self).apply(
37+
project_state, schema_editor, collect_sql=collect_sql
38+
)
3739

3840
def unapply(self, project_state, schema_editor, collect_sql=False):
3941
if schema_editor.connection.alias == "mysql":
4042
return project_state
4143

42-
return super().unapply(project_state, schema_editor, collect_sql=collect_sql)
44+
return super(Migration, self).unapply(
45+
project_state, schema_editor, collect_sql=collect_sql
46+
)

django_check_constraint/settings.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
# Database
7676
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
77-
TEST_ENV_DB = os.environ.get("ENV_DB", "").split(",")
77+
TEST_ENV_DB = [] if "ENV_DB" not in os.environ else os.environ["ENV_DB"].split(",")
7878

7979
DATABASES = {
8080
"default": {
@@ -84,6 +84,12 @@
8484
}
8585
}
8686

87+
if "sqlite3" in TEST_ENV_DB:
88+
DATABASES["sqlite3"] = {
89+
"ENGINE": "django.db.backends.sqlite3",
90+
"NAME": ":memory:",
91+
"TEST": {"DEPENDENCIES": []},
92+
}
8793

8894
if "postgres" in TEST_ENV_DB:
8995
DATABASES["postgres"] = {

noxfile.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@
1919

2020
@nox.session(python=["3.5", "3.6", "3.7", "3.8"])
2121
@nox.parametrize("django", ["2.2.10", "3.0", "3.0.1", "3.0.2", "3.0.3"])
22-
@nox.parametrize("database", ["postgres", "mysql"])
22+
@nox.parametrize("database", ["postgres", "mysql", "sqlite3"])
2323
def tests(session, django, database):
2424
if django.split(".")[0] == "3" and session.python == "3.5":
2525
session.skip("Python: {} and django: {}".format(session.python, django))
2626

27-
session.install(
28-
*DB_PACKAGE[database][session.python],
29-
env={
30-
"LDFLAGS": "-L/usr/local/opt/[email protected]/lib",
31-
"CPPFLAGS": "-I/usr/local/opt/[email protected]/include",
32-
}
33-
)
27+
if database != "sqlite3":
28+
session.install(
29+
*DB_PACKAGE[database][session.python],
30+
env={
31+
"LDFLAGS": "-L/usr/local/opt/[email protected]/lib",
32+
"CPPFLAGS": "-I/usr/local/opt/[email protected]/include",
33+
}
34+
)
3435
session.install("django=={}".format(django))
35-
session.run("bash", "-c", "make test", env={"ENV_DB": database})
36+
session.run("bash", "-c", "make test", external=True, env={"ENV_DB": database})
3637

3738

3839
@nox.session

0 commit comments

Comments
 (0)