Skip to content

Commit

Permalink
Further test fixes following dist_dir changes
Browse files Browse the repository at this point in the history
  • Loading branch information
inclement committed Sep 22, 2019
1 parent 1222be3 commit ee77a12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pythonforandroid/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def dist_dir(self):
'''The dist dir at which to place the finished distribution.'''
if self.distribution is None:
raise BuildInterruptingException(
'Tried to access {}.dist_dir, but {}.distribution '
'Internal error: tried to access {}.dist_dir, but {}.distribution '
'is None'.format(self, self))
return self.distribution.dist_dir

Expand Down
2 changes: 2 additions & 0 deletions pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pythonforandroid.util import BuildInterruptingException
from pythonforandroid.entrypoints import main


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

APK_SUFFIX = '.apk'


def add_boolean_option(parser, names, no_names=None,
default=True, dest=None, description=None):
group = parser.add_argument_group(description=description)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pythonforandroid.recipe import Recipe
from pythonforandroid.archs import ArchARMv7_a
from pythonforandroid.build import Context
from pythonforandroid.util import BuildInterruptingException

from test_graph import get_fake_recipe

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

# test dist_dir error
# bs.dist_dir should raise an error if there is no distribution to query
bs.distribution = None
with self.assertRaises(SystemExit) as e:
with self.assertRaises(BuildInterruptingException):
bs.dist_dir
self.assertEqual(e.exception.args[0], 1)

# test dist_dir success
self.setUp_distribution_with_bootstrap(bs)
Expand Down Expand Up @@ -255,8 +255,8 @@ def test_prepare_dist_dir(self, mock_ensure_dir):
"""
bs = Bootstrap().get_bootstrap("sdl2", self.ctx)

bs.prepare_dist_dir("fake_name")
mock_ensure_dir.assert_called_once_with(bs.dist_dir)
bs.prepare_dist_dir()
mock_ensure_dir.assert_called_once()

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

0 comments on commit ee77a12

Please sign in to comment.