mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2026-02-16 09:57:49 +00:00
use hatch-dotenv plugin to load env vars for tests
fail fast if .test.env is not found
This commit is contained in:
parent
7f3d47e7b0
commit
d88a0b62ad
@ -35,6 +35,9 @@ obsws-cli = "obsws_cli:app"
|
|||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
path = "obsws_cli/__about__.py"
|
path = "obsws_cli/__about__.py"
|
||||||
|
|
||||||
|
[tool.hatch.env]
|
||||||
|
requires = ["hatch-dotenv"]
|
||||||
|
|
||||||
[tool.hatch.envs.default]
|
[tool.hatch.envs.default]
|
||||||
dependencies = ["click-man>=0.5.1"]
|
dependencies = ["click-man>=0.5.1"]
|
||||||
|
|
||||||
@ -45,6 +48,10 @@ man = "python man/generate.py --output=./man"
|
|||||||
[tool.hatch.envs.hatch-test]
|
[tool.hatch.envs.hatch-test]
|
||||||
randomize = true
|
randomize = true
|
||||||
|
|
||||||
|
[tool.hatch.env.collectors.dotenv.hatch-test]
|
||||||
|
env-files = [".env", ".test.env"]
|
||||||
|
fail-on-missing = true
|
||||||
|
|
||||||
[tool.hatch.envs.types]
|
[tool.hatch.envs.types]
|
||||||
extra-dependencies = ["mypy>=1.0.0"]
|
extra-dependencies = ["mypy>=1.0.0"]
|
||||||
[tool.hatch.envs.types.scripts]
|
[tool.hatch.envs.types.scripts]
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import obsws_python as obsws
|
import obsws_python as obsws
|
||||||
from dotenv import find_dotenv, load_dotenv
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
@ -34,14 +33,12 @@ def pytest_sessionstart(session):
|
|||||||
)
|
)
|
||||||
print(' '.join(out))
|
print(' '.join(out))
|
||||||
|
|
||||||
load_dotenv(find_dotenv('.test.env'))
|
|
||||||
|
|
||||||
session.obsws.set_stream_service_settings(
|
session.obsws.set_stream_service_settings(
|
||||||
'rtmp_common',
|
'rtmp_common',
|
||||||
{
|
{
|
||||||
'service': 'Twitch',
|
'service': 'Twitch',
|
||||||
'server': 'auto',
|
'server': 'auto',
|
||||||
'key': os.environ['OBS_STREAM_KEY'],
|
'key': os.environ['OBSWS_CLI_TESTS_STREAM_KEY'],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +60,7 @@ def pytest_sessionstart(session):
|
|||||||
'linux': 'pulse_output_capture',
|
'linux': 'pulse_output_capture',
|
||||||
'darwin': 'coreaudio_output_capture',
|
'darwin': 'coreaudio_output_capture',
|
||||||
}
|
}
|
||||||
platform = os.environ.get('OBS_TESTS_PLATFORM', os.uname().sysname.lower())
|
platform = os.environ['OBSWS_CLI_TESTS_PLATFORM']
|
||||||
try:
|
try:
|
||||||
session.obsws.create_input(
|
session.obsws.create_input(
|
||||||
sceneName='pytest_scene',
|
sceneName='pytest_scene',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user