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

Remove doctest dependency on ethtoken #1395

Merged
merged 8 commits into from
Jul 26, 2019
Merged

Remove doctest dependency on ethtoken #1395

merged 8 commits into from
Jul 26, 2019

Conversation

stefanmendoza
Copy link
Contributor

What was wrong?

** Reopened PR from #1202 **

ethtoken has a dependency on web3 and web3 depends on ethtoken for doctest. We should remove this circular dependency and just include the EIP20 ABI in the doctest for now.

See: carver/ethtoken.py#4 (comment)

How was it fixed?

Remove ethtoken dependency and added the EIP20 ABI to the relevant test.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@stefanmendoza
Copy link
Contributor Author

stefanmendoza commented Jul 21, 2019

@pipermerriam / @carver / @kclowes

Reopened this from #1202. @pipermerriam - I addressed this comment in the second commit here:
9102db0


Before

Screen Shot 2019-07-21 at 4 02 48 AM

After

Screen Shot 2019-07-21 at 4 02 11 AM

@@ -109,7 +109,7 @@ pytest -n 4 -f --maxfail=1

2. Execute `tox` for the tests

There are multiple [components](https://github.com/ethereum/web3.py/blob/master/.travis.yml#L53) of the tests. You can run test to against specific component. For example:
There are multiple [components](https://github.com/ethereum/web3.py/blob/master/.circleci/config.yml#L144) of the tests. You can run test to against specific component. For example:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to a similar line to what was linked before as the project no longer uses Travis. Previously pointed to this:
https://github.com/ethereum/web3.py/blob/v4.9.0/.travis.yml#L53

.. doctest::

>>> from ethtoken.abi import EIP20_ABI
Copy link
Collaborator

Choose a reason for hiding this comment

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

I still think it's important for people to be able to run the examples locally, which this breaks. At least, we should link to the ABI, as we discussed in: #1202 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean put a literal link to the ABI? Like as a comment?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Right, a link so that documentation readers can fill in the EIP20_ABI variable when they run it in their own console.

Copy link
Contributor Author

@stefanmendoza stefanmendoza Jul 22, 2019

Choose a reason for hiding this comment

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

Does this look fine? Also, just curious, but is it redundant to set nonce = 0 in the setup?

a27a5a4#diff-0c4e706274c9fa7b8006416f2043fb46R276

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, looks redundant to me.

Copy link
Contributor Author

@stefanmendoza stefanmendoza Jul 22, 2019

Choose a reason for hiding this comment

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

I was going to remove it, but it actually seems it's set because we don't actually make the call below:

>>> nonce = w3.eth.getTransactionCount('0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') # doctest: +SKIP

Copy link
Collaborator

@carver carver left a comment

Choose a reason for hiding this comment

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

Looks GTG (after removing the setup nonce if you like)

@stefanmendoza
Copy link
Contributor Author

@carver the nonce assignment isn't actually called in the doctest, so I left the nonce = 0 assignment:

>>> nonce = w3.eth.getTransactionCount('0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') # doctest: +SKIP

Should be good to go once the build finishes!

@stefanmendoza
Copy link
Contributor Author

@carver @pipermerriam bumping this 🎉

@carver carver merged commit 24d15cb into ethereum:master Jul 26, 2019
.. doctest::

>>> from ethtoken.abi import EIP20_ABI
# When running locally, execute the statements found in the file linked below to load the EIP20_ABI variable.
# See: https://github.com/carver/ethtoken.py/blob/v0.0.1-alpha.4/ethtoken/abi.py
Copy link
Member

Choose a reason for hiding this comment

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

cc @njgheorghita you might update this sometime with an optional way to load the ABI using an EthPM package.

@stefanmendoza stefanmendoza deleted the ethtoken-doctest-fix branch July 27, 2019 19:53
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.

3 participants