Skip to content

Commit

Permalink
Merge pull request #2987 from AndreMiras/feature/test_sdl2_mixer
Browse files Browse the repository at this point in the history
✅ Fix broken sdl2 mixer test
  • Loading branch information
AndreMiras authored Mar 7, 2024
2 parents 8aee887 + eca86d2 commit 8eacdc0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
8 changes: 7 additions & 1 deletion tests/recipes/test_sdl2_mixer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from tests.recipes.recipe_lib_test import RecipeCtx
from tests.recipes.recipe_ctx import RecipeCtx


class TestSDL2MixerRecipe(RecipeCtx, unittest.TestCase):
Expand All @@ -8,6 +8,12 @@ class TestSDL2MixerRecipe(RecipeCtx, unittest.TestCase):
"""
recipe_name = "sdl2_mixer"

def setUp(self):
"""Setups bootstrap build_dir."""
super().setUp()
bootstrap = self.ctx.bootstrap
bootstrap.build_dir = bootstrap.get_build_dir()

def test_get_include_dirs(self):
list_of_includes = self.recipe.get_include_dirs(self.arch)
self.assertIsInstance(list_of_includes, list)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from pythonforandroid.util import BuildInterruptingException
from pythonforandroid.androidndk import AndroidNDK

from test_graph import get_fake_recipe
from tests.test_graph import get_fake_recipe


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

# Test a random bootstrap is always lower priority than sdl2:
class _FakeBootstrap(object):
class _FakeBootstrap:
def __init__(self, name):
self.name = name
bs1 = _FakeBootstrap("alpha")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_recipe.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
import pytest
import tempfile
import types
import unittest
import warnings
from unittest import mock
from backports import tempfile

from pythonforandroid.build import Context
from pythonforandroid.recipe import Recipe, TargetPythonRecipe, import_recipe
from pythonforandroid.archs import ArchAarch_64
from pythonforandroid.bootstrap import Bootstrap
from test_bootstrap import BaseClassSetupBootstrap
from tests.test_bootstrap import BaseClassSetupBootstrap


def patch_logger(level):
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ basepython = python3
deps =
pytest
py3: coveralls
backports.tempfile
# posargs will be replaced by the tox args, so you can override pytest
# args e.g. `tox -- tests/test_graph.py`
commands = pytest {posargs:tests/}
Expand Down

0 comments on commit 8eacdc0

Please sign in to comment.