File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
tests/unit/core/management Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,11 @@ def fs(fs: FakeFilesystem) -> FakeFilesystem:
148148 """
149149 app_path = os .path .dirname (os .path .abspath (__file__ ))
150150 site_packages = site .getsitepackages () # Allow files within dependencies
151- fs .add_real_paths ([* site_packages , app_path ])
151+ paths_to_add = [app_path ]
152+ for site_package_path in site_packages :
153+ if not site_package_path .startswith (app_path ):
154+ paths_to_add .append (site_package_path )
155+ fs .add_real_paths (paths_to_add )
152156 return fs
153157
154158
Original file line number Diff line number Diff line change 11import pytest
2+ from django .conf import settings
23from django .core .management import CommandError , call_command
34
5+ DATABASES_LIST = list (settings .DATABASES .keys ())
6+
47
58def test_makemigrations_without_name_raises_error () -> None :
69 with pytest .raises (CommandError , match = "--name/-n is a required argument" ):
710 call_command ("makemigrations" )
811
912
10- @pytest .mark .django_db (databases = [ "default" , "analytics" ] )
13+ @pytest .mark .django_db (databases = DATABASES_LIST )
1114def test_makemigrations_with_check_changes_runs_without_error () -> None :
1215 call_command ("makemigrations" , check_changes = True )
1316
1417
15- @pytest .mark .django_db (databases = [ "default" , "analytics" ] )
18+ @pytest .mark .django_db (databases = DATABASES_LIST )
1619def test_makemigrations_with_dry_run_runs_without_error () -> None :
1720 call_command ("makemigrations" , dry_run = True )
1821
1922
20- @pytest .mark .django_db (databases = [ "default" , "analytics" ] )
23+ @pytest .mark .django_db (databases = DATABASES_LIST )
2124def test_makemigrations_with_name_runs_without_error () -> None :
2225 call_command ("makemigrations" , name = "some_useful_name" )
You can’t perform that action at this time.
0 commit comments