mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-21 21:58:05 +00:00
✅ Add support for TEST_BUILD environment variable
In the `test_build` function, added support for the TEST_BUILD environment variable. Now, if the variable is set to True, the `test_build` function will run; otherwise, it will skip the test and output a related message. Additionally, introduced a new pytest fixture `if_test_build` to check if the test is enabled.
This commit is contained in:
parent
912a41fe45
commit
009f74839f
@ -3,4 +3,5 @@ ACCOUNT_ID=
|
|||||||
GENSHIN_PLAYER_ID=
|
GENSHIN_PLAYER_ID=
|
||||||
STARRAIL_PLAYER_ID=
|
STARRAIL_PLAYER_ID=
|
||||||
# STOKEN=
|
# STOKEN=
|
||||||
# LOGIN_TICKET=
|
# LOGIN_TICKET=
|
||||||
|
# TEST_BUILD=
|
@ -71,3 +71,9 @@ def stoken() -> Optional[str]: # skipcq: PY-D0003
|
|||||||
def login_ticket() -> Optional[str]: # skipcq: PY-D0003
|
def login_ticket() -> Optional[str]: # skipcq: PY-D0003
|
||||||
_login_ticket = os.environ.get("LOGIN_TICKET")
|
_login_ticket = os.environ.get("LOGIN_TICKET")
|
||||||
return _login_ticket
|
return _login_ticket
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session")
|
||||||
|
def if_test_build() -> bool: # skipcq: PY-D0003
|
||||||
|
_test_build = bool(os.environ.get("TEST_BUILD", False))
|
||||||
|
return _test_build
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
def test_build():
|
|
||||||
|
def test_build(if_test_build: bool):
|
||||||
|
if not if_test_build:
|
||||||
|
pytest.skip("TEST_BUILD not enabled")
|
||||||
assert os.system("python setup.py") == 0 # pragma: no cover
|
assert os.system("python setup.py") == 0 # pragma: no cover
|
||||||
|
Loading…
Reference in New Issue
Block a user