mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-04 02:01:48 +01:00
Revert debug changes and improve TEST_WITH_OPT_DEPS handling
This commit is contained in:
parent
9cabf0e03b
commit
92851a4c7b
4 changed files with 17 additions and 13 deletions
|
@ -27,6 +27,9 @@ def env_var_2_bool(env_var: object) -> bool:
|
|||
return env_var.lower().strip() == "true"
|
||||
|
||||
|
||||
GITHUB_ACTION = os.getenv("GITHUB_ACTION", "")
|
||||
TEST_WITH_OPT_DEPS = env_var_2_bool(os.getenv("TEST_WITH_OPT_DEPS", "false"))
|
||||
RUN_TEST_OFFICIAL = env_var_2_bool(os.getenv("TEST_OFFICIAL"))
|
||||
GITHUB_ACTION: bool = env_var_2_bool(os.getenv("GITHUB_ACTION", "false"))
|
||||
TEST_WITH_OPT_DEPS: bool = env_var_2_bool(os.getenv("TEST_WITH_OPT_DEPS", "")) or (
|
||||
# on local setups, we usually want to test with optional dependencies
|
||||
not GITHUB_ACTION
|
||||
)
|
||||
RUN_TEST_OFFICIAL: bool = env_var_2_bool(os.getenv("TEST_OFFICIAL"))
|
||||
|
|
|
@ -21,12 +21,13 @@ import calendar
|
|||
import contextlib
|
||||
import datetime as dtm
|
||||
import logging
|
||||
import platform
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from telegram.ext import ApplicationBuilder, CallbackContext, ContextTypes, Defaults, Job, JobQueue
|
||||
from tests.auxil.envvars import TEST_WITH_OPT_DEPS
|
||||
from tests.auxil.envvars import GITHUB_ACTION, TEST_WITH_OPT_DEPS
|
||||
from tests.auxil.pytest_classes import make_bot
|
||||
from tests.auxil.slots import mro_slots
|
||||
|
||||
|
@ -64,13 +65,13 @@ class TestNoJobQueue:
|
|||
Job(None)
|
||||
|
||||
|
||||
# @pytest.mark.skipif(
|
||||
# not TEST_WITH_OPT_DEPS, reason="Only relevant if the optional dependency is installed"
|
||||
# )
|
||||
# @pytest.mark.skipif(
|
||||
# bool(GITHUB_ACTION and platform.system() in ["Windows", "Darwin"]),
|
||||
# reason="On Windows & MacOS precise timings are not accurate.",
|
||||
# )
|
||||
@pytest.mark.skipif(
|
||||
not TEST_WITH_OPT_DEPS, reason="Only relevant if the optional dependency is installed"
|
||||
)
|
||||
@pytest.mark.skipif(
|
||||
GITHUB_ACTION and platform.system() in ["Windows", "Darwin"],
|
||||
reason="On Windows & MacOS precise timings are not accurate.",
|
||||
)
|
||||
@pytest.mark.flaky(10, 1) # Timings aren't quite perfect
|
||||
class TestJobQueue:
|
||||
result = 0
|
||||
|
|
|
@ -142,7 +142,7 @@ class TestBaseRateLimiter:
|
|||
not TEST_WITH_OPT_DEPS, reason="Only relevant if the optional dependency is installed"
|
||||
)
|
||||
@pytest.mark.skipif(
|
||||
bool(GITHUB_ACTION and platform.system() == "Darwin"),
|
||||
GITHUB_ACTION and platform.system() == "Darwin",
|
||||
reason="The timings are apparently rather inaccurate on MacOS.",
|
||||
)
|
||||
@pytest.mark.flaky(10, 1) # Timings aren't quite perfect
|
||||
|
|
|
@ -154,7 +154,7 @@ def inline_results():
|
|||
BASE_GAME_SCORE = 60 # Base game score for game tests
|
||||
|
||||
xfail = pytest.mark.xfail(
|
||||
bool(GITHUB_ACTION), # This condition is only relevant for github actions game tests.
|
||||
GITHUB_ACTION, # This condition is only relevant for github actions game tests.
|
||||
reason=(
|
||||
"Can fail due to race conditions when multiple test suites "
|
||||
"with the same bot token are run at the same time"
|
||||
|
|
Loading…
Reference in a new issue