-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: common and worker runtime dependencies
common should only depend on pydantic and worker runtime should only depend on pydantic and common
- Loading branch information
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
|
||
from pytest_archon import archrule | ||
|
||
import questionpy_common | ||
import questionpy_server.worker.runtime | ||
|
||
STD_MODULES_PATTERN = [f"{module}*" for module in sys.stdlib_module_names] | ||
|
||
|
||
def test_questionpy_common_should_only_import_pydantic() -> None: | ||
( | ||
archrule("questionpy_common_should_only_import_pydantic") | ||
.match("*") | ||
.should_not_import("*") | ||
.may_import(*STD_MODULES_PATTERN) | ||
.may_import("pydantic*") | ||
.may_import("questionpy_common*") | ||
.check(questionpy_common) | ||
) | ||
|
||
|
||
def test_questionpy_worker_runtime_should_only_import_pydantic_and_questionpy_common() -> None: | ||
( | ||
archrule("questionpy_worker_runtime_should_only_import_pydantic_and_questionpy_common") | ||
.match("*") | ||
.should_not_import("*") | ||
.may_import(*STD_MODULES_PATTERN) | ||
.may_import("pydantic*") | ||
.may_import("questionpy_common*") | ||
.may_import("questionpy_server.worker.runtime*") | ||
.check(questionpy_server.worker.runtime) | ||
) |