Skip to content

Commit 8eacdc0

Browse files
authored
Merge pull request kivy#2987 from AndreMiras/feature/test_sdl2_mixer
✅ Fix broken sdl2 mixer test
2 parents 8aee887 + eca86d2 commit 8eacdc0

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

tests/recipes/test_sdl2_mixer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
from tests.recipes.recipe_lib_test import RecipeCtx
2+
from tests.recipes.recipe_ctx import RecipeCtx
33

44

55
class TestSDL2MixerRecipe(RecipeCtx, unittest.TestCase):
@@ -8,6 +8,12 @@ class TestSDL2MixerRecipe(RecipeCtx, unittest.TestCase):
88
"""
99
recipe_name = "sdl2_mixer"
1010

11+
def setUp(self):
12+
"""Setups bootstrap build_dir."""
13+
super().setUp()
14+
bootstrap = self.ctx.bootstrap
15+
bootstrap.build_dir = bootstrap.get_build_dir()
16+
1117
def test_get_include_dirs(self):
1218
list_of_includes = self.recipe.get_include_dirs(self.arch)
1319
self.assertIsInstance(list_of_includes, list)

tests/test_bootstrap.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
from pythonforandroid.util import BuildInterruptingException
1616
from pythonforandroid.androidndk import AndroidNDK
1717

18-
from test_graph import get_fake_recipe
18+
from tests.test_graph import get_fake_recipe
1919

2020

21-
class BaseClassSetupBootstrap(object):
21+
class BaseClassSetupBootstrap:
2222
"""
23-
An class object which is intended to be used as a base class to configure
23+
An class which is intended to be used as a base class to configure
2424
an inherited class of `unittest.TestCase`. This class will override the
2525
`setUp` and `tearDown` methods.
2626
"""
@@ -115,7 +115,7 @@ def test__cmp_bootstraps_by_priority(self):
115115
) < 0)
116116

117117
# Test a random bootstrap is always lower priority than sdl2:
118-
class _FakeBootstrap(object):
118+
class _FakeBootstrap:
119119
def __init__(self, name):
120120
self.name = name
121121
bs1 = _FakeBootstrap("alpha")

tests/test_recipe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import os
22
import pytest
3+
import tempfile
34
import types
45
import unittest
56
import warnings
67
from unittest import mock
7-
from backports import tempfile
88

99
from pythonforandroid.build import Context
1010
from pythonforandroid.recipe import Recipe, TargetPythonRecipe, import_recipe
1111
from pythonforandroid.archs import ArchAarch_64
1212
from pythonforandroid.bootstrap import Bootstrap
13-
from test_bootstrap import BaseClassSetupBootstrap
13+
from tests.test_bootstrap import BaseClassSetupBootstrap
1414

1515

1616
def patch_logger(level):

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ basepython = python3
66
deps =
77
pytest
88
py3: coveralls
9-
backports.tempfile
109
# posargs will be replaced by the tox args, so you can override pytest
1110
# args e.g. `tox -- tests/test_graph.py`
1211
commands = pytest {posargs:tests/}

0 commit comments

Comments
 (0)