File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11import os
22import shutil
3+ import tempfile
34from unittest import TestCase
45
56from piccolo .apps .app .commands .new import new , module_exists
@@ -13,7 +14,7 @@ def test_module_exists(self):
1314
1415class TestNewApp (TestCase ):
1516 def test_new (self ):
16- root = "/tmp"
17+ root = tempfile . gettempdir ()
1718 app_name = "my_app"
1819
1920 app_path = os .path .join (root , app_name )
@@ -30,7 +31,7 @@ def test_new_with_clashing_name(self):
3031 Test trying to create an app with the same name as a builtin Python
3132 package - it shouldn't be allowed.
3233 """
33- root = "/tmp"
34+ root = tempfile . gettempdir ()
3435 app_name = "sys"
3536
3637 with self .assertRaises (SystemExit ) as context :
Original file line number Diff line number Diff line change 11import os
22import shutil
3+ import tempfile
34from unittest import TestCase
45from unittest .mock import patch
56
@@ -15,7 +16,7 @@ class TestNewApp(TestCase):
1516 "piccolo.apps.asgi.commands.new.get_server" , return_value = SERVERS [0 ],
1617 )
1718 def test_new (self , * args , ** kwargs ):
18- root = "/tmp/ asgi_app"
19+ root = os . path . join ( tempfile . gettempdir (), " asgi_app")
1920
2021 if os .path .exists (root ):
2122 shutil .rmtree (root )
Original file line number Diff line number Diff line change 11import os
22import shutil
3+ import tempfile
34from unittest import TestCase
45from unittest .mock import call , patch , MagicMock
56
@@ -20,8 +21,9 @@ def test_create_new_migration(self):
2021 """
2122 Create a manual migration (i.e. non-auto).
2223 """
23- migration_folder = "/tmp/piccolo_migrations/"
24-
24+ migration_folder = os .path .join (
25+ tempfile .gettempdir (), "piccolo_migrations"
26+ )
2527 if os .path .exists (migration_folder ):
2628 shutil .rmtree (migration_folder )
2729
Original file line number Diff line number Diff line change 11import os
22from unittest import TestCase
3+ import tempfile
34
45from piccolo .apps .project .commands .new import new
56
67
78class TestNewProject (TestCase ):
89 def test_new (self ):
9- root = "/tmp"
10+ root = tempfile . gettempdir ()
1011
11- file_path = "/tmp/ piccolo_conf.py"
12+ file_path = os . path . join ( root , " piccolo_conf.py")
1213
1314 if os .path .exists (file_path ):
1415 os .unlink (file_path )
You can’t perform that action at this time.
0 commit comments