@@ -235,6 +235,7 @@ def more_nested_submodule():
235
235
class TestFindDjangoFiles :
236
236
237
237
def test_non_nested (self , fake_home , non_nested_submodule ):
238
+
238
239
project = DjangoProject ('mydomain.com' )
239
240
shutil .copytree (non_nested_submodule , project .project_path )
240
241
expected_settings_path = project .project_path / 'myproject/settings.py'
@@ -361,14 +362,49 @@ class TestUpdateWsgiFile:
361
362
362
363
def test_updates_wsgi_file_from_template (self ):
363
364
project = DjangoProject ('mydomain.com' )
364
- project .wsgi_file_path = tempfile .NamedTemporaryFile ().name
365
+ project .wsgi_file_path = Path (tempfile .NamedTemporaryFile ().name )
366
+ project .settings_path = Path ('/path/to/settingsfolder/settings.py' )
365
367
template = open (Path (pythonanywhere .django_project .__file__ ).parent / 'wsgi_file_template.py' ).read ()
366
368
367
369
project .update_wsgi_file ()
368
370
369
371
with open (project .wsgi_file_path ) as f :
370
372
contents = f .read ()
371
- assert contents == template .format (project_path = project .project_path )
373
+ print (contents )
374
+ assert contents == template .format (project = project )
375
+
376
+
377
+ @pytest .mark .slowtest
378
+ def test_actually_produces_wsgi_file_that_can_import_project_non_nested (
379
+ self , fake_home , non_nested_submodule , virtualenvs_folder
380
+ ):
381
+ project = DjangoProject ('mydomain.com' )
382
+ shutil .copytree (non_nested_submodule , project .project_path )
383
+ project .create_virtualenv ('3.6' )
384
+<
10000
/span> project .find_django_files ()
385
+ project .wsgi_file_path = Path (tempfile .NamedTemporaryFile ().name )
386
+
387
+ project .update_wsgi_file ()
388
+
389
+ print (open (project .wsgi_file_path ).read ())
390
+ subprocess .check_output ([project .virtualenv_path / 'bin/python' , project .wsgi_file_path ])
391
+
392
+
393
+ @pytest .mark .slowtest
394
+ def test_actually_produces_wsgi_file_that_can_import_nested_project (
395
+ self , fake_home , more_nested_submodule , virtualenvs_folder
396
+ ):
397
+ project = DjangoProject ('mydomain.com' )
398
+ shutil .copytree (more_nested_submodule , project .project_path )
399
+ project .create_virtualenv ('3.6' )
400
+ project .find_django_files ()
401
+ project .wsgi_file_path = Path (tempfile .NamedTemporaryFile ().name )
402
+
403
+ project .update_wsgi_file ()
404
+
405
+ print (open (project .wsgi_file_path ).read ())
406
+ subprocess .check_output ([project .virtualenv_path / 'bin/python' , project .wsgi_file_path ])
407
+
372
408
373
409
374
410
0 commit comments