Skip to content

Commit

Permalink
tests as its own subproject (#18698)
Browse files Browse the repository at this point in the history
extend virtual_project_analysis to treat all files under chia/_tests as its own subproject. Since the tests depend on the production code,this will prevent production code from depending on tests
  • Loading branch information
arvidn authored Oct 22, 2024
1 parent 4f00f63 commit 6bbcd2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chia/util/virtual_project_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class ChiaFile:

@classmethod
def parse(cls, file_path: Path) -> ChiaFile:
# everything under chia/_tests belong to the "tests" subproject. It
# (obviously) depends on everything, but no production code is allowed
# to depend back on the tests.
if list(file_path.parts[0:2]) == ["chia", "_tests"]:
return cls(file_path, Annotation("tests", True))

with open(file_path, encoding="utf-8", errors="ignore") as f:
file_string = f.read().strip()
return cls(file_path, Annotation.parse(file_string))
Expand Down

0 comments on commit 6bbcd2d

Please sign in to comment.