Skip to content
Snippets Groups Projects
Commit 4a8138d1 authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Windows compatibility: don't try to re-open temporary file

parent 3b239267
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,8 @@ class PIDFileTest(AbstractCommandTest):
)
def test_alive(self):
with tempfile.NamedTemporaryFile(suffix='.pid') as tmpfile:
pidfile = Path(tmpfile.name)
with tempfile.TemporaryDirectory(suffix='.pid') as tmpdir:
pidfile = Path(tmpdir) / 'pidfile.pid'
my_pid = os.getpid()
pidfile.write_text(str(my_pid))
......@@ -37,8 +37,8 @@ class PIDFileTest(AbstractCommandTest):
self.assertIn(str(psutil.Process(my_pid)), msg)
def test_alive_newlines(self):
with tempfile.NamedTemporaryFile(suffix='.pid') as tmpfile:
pidfile = Path(tmpfile.name)
with tempfile.TemporaryDirectory(suffix='.pid') as tmpdir:
pidfile = Path(tmpdir) / 'pidfile.pid'
my_pid = os.getpid()
pidfile.write_text('\n%s\n' % my_pid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment