Skip to content

Commit ee77a12

Browse files
committed
Further test fixes following dist_dir changes
1 parent 1222be3 commit ee77a12

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pythonforandroid/bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def dist_dir(self):
9696
'''The dist dir at which to place the finished distribution.'''
9797
if self.distribution is None:
9898
raise BuildInterruptingException(
99-
'Tried to access {}.dist_dir, but {}.distribution '
99+
'Internal error: tried to access {}.dist_dir, but {}.distribution '
100100
'is None'.format(self, self))
101101
return self.distribution.dist_dir
102102

pythonforandroid/toolchain.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from pythonforandroid.util import BuildInterruptingException
1616
from pythonforandroid.entrypoints import main
1717

18+
1819
def check_python_dependencies():
1920
# Check if the Python requirements are installed. This appears
2021
# before the imports because otherwise they're imported elsewhere.
@@ -102,6 +103,7 @@ def check_python_dependencies():
102103

103104
APK_SUFFIX = '.apk'
104105

106+
105107
def add_boolean_option(parser, names, no_names=None,
106108
default=True, dest=None, description=None):
107109
group = parser.add_argument_group(description=description)

tests/test_bootstrap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pythonforandroid.recipe import Recipe
1212
from pythonforandroid.archs import ArchARMv7_a
1313
from pythonforandroid.build import Context
14+
from pythonforandroid.util import BuildInterruptingException
1415

1516
from test_graph import get_fake_recipe
1617

@@ -75,11 +76,10 @@ def test_attributes(self):
7576
self.assertEqual(bs.jni_dir, "sdl2/jni")
7677
self.assertEqual(bs.get_build_dir_name(), "sdl2-python3")
7778

78-
# test dist_dir error
79+
# bs.dist_dir should raise an error if there is no distribution to query
7980
bs.distribution = None
80-
with self.assertRaises(SystemExit) as e:
81+
with self.assertRaises(BuildInterruptingException):
8182
bs.dist_dir
82-
self.assertEqual(e.exception.args[0], 1)
8383

8484
# test dist_dir success
8585
self.setUp_distribution_with_bootstrap(bs)
@@ -255,8 +255,8 @@ def test_prepare_dist_dir(self, mock_ensure_dir):
255255
"""
256256
bs = Bootstrap().get_bootstrap("sdl2", self.ctx)
257257

258-
bs.prepare_dist_dir("fake_name")
259-
mock_ensure_dir.assert_called_once_with(bs.dist_dir)
258+
bs.prepare_dist_dir()
259+
mock_ensure_dir.assert_called_once()
260260

261261
@mock.patch("pythonforandroid.bootstrap.open", create=True)
262262
@mock.patch("pythonforandroid.util.chdir")

0 commit comments

Comments
 (0)