Merge pull request #1956 from huge-success/fix-load-module-test

Fix load module test
This commit is contained in:
Ashley Sommer 2020-10-25 22:09:24 +10:00 committed by GitHub
commit 9e048bc0c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -80,13 +80,13 @@ requirements = [
ujson,
"aiofiles>=0.3.0",
"websockets>=8.1,<9.0",
"multidict>=4.0,<5.0",
"multidict==5.0.0",
"httpx==0.15.4",
]
tests_require = [
"pytest==5.2.1",
"multidict>=4.0,<5.0",
"multidict==5.0.0",
"gunicorn",
"pytest-cov",
"httpcore==0.3.0",

View File

@ -10,7 +10,7 @@ from sanic.utils import load_module_from_file_location
@pytest.fixture
def loaded_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"])
def test_loaded_module_from_file_location_name(
loaded_module_from_file_location,
):
assert loaded_module_from_file_location.__name__ == "app_test_config"
def test_loaded_module_from_file_location_name(loaded_module_from_file_location,):
name = loaded_module_from_file_location.__name__
if "C:\\" in name:
name = name.split("\\")[-1]
assert name == "app_test_config"
def test_load_module_from_file_location_with_non_existing_env_variable():