Merge pull request #1956 from huge-success/fix-load-module-test
Fix load module test
This commit is contained in:
commit
9e048bc0c3
4
setup.py
4
setup.py
@ -80,13 +80,13 @@ requirements = [
|
|||||||
ujson,
|
ujson,
|
||||||
"aiofiles>=0.3.0",
|
"aiofiles>=0.3.0",
|
||||||
"websockets>=8.1,<9.0",
|
"websockets>=8.1,<9.0",
|
||||||
"multidict>=4.0,<5.0",
|
"multidict==5.0.0",
|
||||||
"httpx==0.15.4",
|
"httpx==0.15.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
"pytest==5.2.1",
|
"pytest==5.2.1",
|
||||||
"multidict>=4.0,<5.0",
|
"multidict==5.0.0",
|
||||||
"gunicorn",
|
"gunicorn",
|
||||||
"pytest-cov",
|
"pytest-cov",
|
||||||
"httpcore==0.3.0",
|
"httpcore==0.3.0",
|
||||||
|
@ -10,7 +10,7 @@ from sanic.utils import load_module_from_file_location
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def loaded_module_from_file_location():
|
def loaded_module_from_file_location():
|
||||||
return load_module_from_file_location(
|
return load_module_from_file_location(
|
||||||
str(Path(__file__).parent / "static/app_test_config.py")
|
str(Path(__file__).parent / "static" / "app_test_config.py")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -20,10 +20,11 @@ def test_load_module_from_file_location(loaded_module_from_file_location):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.dependency(depends=["test_load_module_from_file_location"])
|
@pytest.mark.dependency(depends=["test_load_module_from_file_location"])
|
||||||
def test_loaded_module_from_file_location_name(
|
def test_loaded_module_from_file_location_name(loaded_module_from_file_location,):
|
||||||
loaded_module_from_file_location,
|
name = loaded_module_from_file_location.__name__
|
||||||
):
|
if "C:\\" in name:
|
||||||
assert loaded_module_from_file_location.__name__ == "app_test_config"
|
name = name.split("\\")[-1]
|
||||||
|
assert name == "app_test_config"
|
||||||
|
|
||||||
|
|
||||||
def test_load_module_from_file_location_with_non_existing_env_variable():
|
def test_load_module_from_file_location_with_non_existing_env_variable():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user