-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make FIRST_PARTY_APPS handling match the behaviour of INSTALLED_APPS
Supercedes #62.
- Loading branch information
1 parent
efed6ad
commit b0553c1
Showing
5 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.apps import apps | ||
from django.test import SimpleTestCase | ||
from django.test.utils import override_settings | ||
|
||
from django_linear_migrations.apps import is_first_party_app_config | ||
|
||
|
||
class IsFirstPartyAppConfigTests(SimpleTestCase): | ||
@override_settings(FIRST_PARTY_APPS=[]) | ||
def test_empty(self): | ||
app_config = apps.get_app_config("testapp") | ||
|
||
assert not is_first_party_app_config(app_config) | ||
|
||
@override_settings(FIRST_PARTY_APPS=["django_linear_migrations"]) | ||
def test_not_named(self): | ||
app_config = apps.get_app_config("testapp") | ||
|
||
assert not is_first_party_app_config(app_config) | ||
|
||
@override_settings(FIRST_PARTY_APPS=["tests.testapp"]) | ||
def test_named_by_path(self): | ||
app_config = apps.get_app_config("testapp") | ||
|
||
assert is_first_party_app_config(app_config) | ||
|
||
@override_settings(FIRST_PARTY_APPS=["tests.testapp.apps.TestAppConfig"]) | ||
def test_named_by_app_config_path(self): | ||
app_config = apps.get_app_config("testapp") | ||
|
||
assert is_first_party_app_config(app_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import django | ||
|
||
if django.VERSION < (3, 2): | ||
default_app_config = "tests.testapp.apps.TestAppConfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class TestAppConfig(AppConfig): | ||
name = "tests.testapp" | ||
verbose_name = "Test App" |