Skip to content

Commit

Permalink
tests: use UWSGI_PLUGINS env var to define plugins tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niol committed Sep 9, 2024
1 parent 9685684 commit 46bb9e1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions t/runner
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ import unittest

TESTS_DIR = os.path.dirname(__file__)
UWSGI_BINARY = os.getenv("UWSGI_BINARY", os.path.join(TESTS_DIR, "..", "uwsgi"))
UWSGI_PLUGINS = os.getenv("UWSGI_PLUGINS", "all").split(" ")
UWSGI_ADDR = "127.0.0.1"
UWSGI_PORT = 8000
UWSGI_HTTP = f"{UWSGI_ADDR}:{UWSGI_PORT}"


def plugins_available(plugins):
available = False
if "all" in UWSGI_PLUGINS:
available = True
else:
available = all([plugin in UWSGI_PLUGINS for plugin in plugins])
return available, f"{plugins} plugins not available but required for this test case"


class UwsgiTest(unittest.TestCase):

def start_server(self, args):
Expand Down Expand Up @@ -72,6 +82,7 @@ class UwsgiTest(unittest.TestCase):
self.testserver.wait()
self.testserver.stdout.close()

@unittest.skipUnless(*plugins_available(["python3"]))
def test_static_expires(self):
self.start_listen_server(
[
Expand Down

0 comments on commit 46bb9e1

Please sign in to comment.