Skip to content

Commit

Permalink
Fix extraneous error on other pytest warningsfilterwarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
saulshanabrook committed Mar 26, 2024
1 parent 188a3c4 commit ae3757e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,13 @@ exclude = ["__snapshots__", "_build", "^conftest.py$"]
python-source = "python"

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib", "-Werror"]
addopts = ["--import-mode=importlib"]
testpaths = ["python"]
python_files = ["test_*.py", "test.py"]
markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"]
norecursedirs = ["__snapshots__"]
filterwarnings = [
"error",
"ignore::numba.core.errors.NumbaPerformanceWarning",
"ignore::pytest_benchmark.logger.PytestBenchmarkWarning",
]
16 changes: 10 additions & 6 deletions python/tests/test_high_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,22 @@ def __init__(self, x: i64Like) -> None: ...


def test_modules() -> None:
m = Module()
with pytest.deprecated_call():
m = Module()

@m.class_
class Numeric(Expr):
ONE: ClassVar[Numeric]

m2 = Module()
with pytest.deprecated_call():
m2 = Module()

@m2.class_
class OtherNumeric(Expr):
@m2.method(cost=10)
def __init__(self, v: i64Like) -> None: ...
with pytest.deprecated_call():

@m2.class_
class OtherNumeric(Expr):
@m2.method(cost=10)
def __init__(self, v: i64Like) -> None: ...

egraph = EGraph([m, m2])

Expand Down
15 changes: 9 additions & 6 deletions python/tests/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ def test_tree_modules():
# assert _BUILTIN_DECLS
# assert BUILTINS._mod_decls == ModuleDeclarations(_BUILTIN_DECLS, [])

A, B, C = Module(), Module(), Module()
with pytest.deprecated_call():
A, B, C = Module(), Module(), Module()
# assert list(A._mod_decls._included_decls) == [_BUILTIN_DECLS]

a = A.relation("a")
b = B.relation("b")
c = C.relation("c")
with pytest.deprecated_call():
a = A.relation("a")
b = B.relation("b")
c = C.relation("c")
A.register(a())
B.register(b())
C.register(c())

D = Module([A, B])
d = D.relation("d")
with pytest.deprecated_call():
D = Module([A, B])
d = D.relation("d")
D.register(d())

assert D._flatted_deps == [A, B]
Expand Down

0 comments on commit ae3757e

Please sign in to comment.