Skip to content

Commit

Permalink
Fix a number of resource warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldoussoren committed Apr 10, 2022
1 parent 531dba5 commit b0e90c4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
7 changes: 7 additions & 0 deletions py2app_tests/test_app_with_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ def start_app(self):
return p

def tearDown(self):
if hasattr(self, "_p"):
self._p.send_signal(9)
try:
self._p.communicate()
except ValueError:
pass
self._p.wait()
kill_child_processes()
time.sleep(1)

Expand Down
11 changes: 10 additions & 1 deletion py2app_tests/test_basic_app_with_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ def tearDownClass(cls):
time.sleep(2)

def tearDown(self):
if hasattr(self, "_p"):
self._p.stdout.close()
try:
self._p.communicate()
except ValueError:
pass

self._p.send_signal(9)
self._p.wait()
kill_child_processes()
time.sleep(1)

Expand All @@ -120,7 +129,7 @@ def start_app(self):
# stdin and stdout are connected to pipes.
path = os.path.join(self.app_dir, "dist/BasicApp.app/Contents/MacOS/BasicApp")

p = subprocess.Popen(
self._p = p = subprocess.Popen(
[path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand Down
10 changes: 9 additions & 1 deletion py2app_tests/test_explicit_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def tearDownClass(cls):
time.sleep(2)

def tearDown(self):
if hasattr(self, "_p"):
try:
self._p.communicate()
except ValueError:
pass

self._p.send_signal(9)
self._p.wait()
kill_child_processes()
time.sleep(1)

Expand All @@ -73,7 +81,7 @@ def start_app(self):
# stdin and stdout are connected to pipes.
path = os.path.join(self.app_dir, "dist/BasicApp.app/Contents/MacOS/BasicApp")

p = subprocess.Popen(
self._p = p = subprocess.Popen(
[path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand Down
9 changes: 8 additions & 1 deletion py2app_tests/test_package_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ def tearDownClass(cls):
time.sleep(2)

def tearDown(self):
if hasattr(self, "_p"):
self._p.send_signal(9)
try:
self._p.communicate()
except ValueError:
pass
self._p.wait()
kill_child_processes()
time.sleep(1)

Expand All @@ -112,7 +119,7 @@ def start_app(self):
# stdin and stdout are connected to pipes.
path = os.path.join(self.app_dir, "dist/BasicApp.app/Contents/MacOS/BasicApp")

p = subprocess.Popen(
self._p = p = subprocess.Popen(
[path],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
Expand Down

0 comments on commit b0e90c4

Please sign in to comment.