Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
from slither import Slither


def pytest_configure(config):
def pytest_configure(config) -> None:
"""Create a temporary directory for the tests to use."""
if is_master():
config.stash["shared_directory"] = tempfile.mkdtemp()


def pytest_unconfigure(config):
def pytest_unconfigure(config) -> None:
"""Remove the temporary directory after the tests are done."""
if is_master():
shutil.rmtree(config.stash["shared_directory"])


def pytest_configure_node(node):
def pytest_configure_node(node) -> None:
"""Configure each worker node with the shared directory."""
node.workerinput["shared_directory"] = node.config.stash["shared_directory"]


def is_master():
def is_master() -> bool:
"""Returns True if the current process is the master process (which does not have a worker id)."""
return os.environ.get("PYTEST_XDIST_WORKER") is None

Expand Down
7 changes: 7 additions & 0 deletions tests/unit/core/test_literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ def test_not_equal_to_non_literal(self):
lit = Literal("100", "uint256")
assert lit != "100"
assert lit != 100
assert lit != None

def test_equal_none_subdenomination(self):
"""Literals with None and absent subdenomination should be equal."""
lit1 = Literal("100", "uint256")
lit2 = Literal("100", "uint256", subdenomination=None)
assert lit1 == lit2