Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new network simulator library in tests #1099

Conversation

pipermerriam
Copy link
Member

What was wrong?

Some of our p2p tests use real networking.

How was it fixed?

Change to use the new library pytest-asyncio-network-simulator which mocks out the networking.

Cute Animal Picture

cat-monkey-shutterstock-76988095-webonly

@pipermerriam pipermerriam requested a review from gsalgado July 26, 2018 20:05
@pipermerriam
Copy link
Member Author

tangentially related: #1100

setup.py Outdated
@@ -50,7 +50,7 @@
"pytest-xdist==1.18.1",
"pytest-watch>=4.1.0,<5",
# only needed for p2p
"pytest-asyncio-network-simulator==0.1.0a1",
"pytest-asyncio-network-simulator==0.1.0a1;python_version>='3.6'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this syntax mean: Only install this if we are in a python 3.6 environment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fancy-pants setup tools wizardy. Slight correction: it means "only if we're in >= Python 3.6"

@@ -30,3 +33,10 @@ def p2p_logger():

return logger
"""


@pytest.fixture
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an autouse=True here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it hilarious that I forgot that. Think I'll add a small test that verifies that asyncio is indeed patched.

@pipermerriam pipermerriam force-pushed the piper/use-network-simulator-in-p2p-tests branch from 99cecc1 to b613297 Compare July 27, 2018 18:01
Copy link
Contributor

@gsalgado gsalgado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pipermerriam pipermerriam merged commit 653d563 into ethereum:master Jul 30, 2018
@pipermerriam pipermerriam deleted the piper/use-network-simulator-in-p2p-tests branch July 30, 2018 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants