Skip to content

Conversation

@jimmysong
Copy link
Contributor

Test added to blockchain.py as adding a new test to reduce test run time.

@fanquake fanquake added the Tests label Apr 19, 2017
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

@jimmysong jimmysong Apr 19, 2017

Choose a reason for hiding this comment

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

flake8 warning: E501 line too long (85 > 79 characters)

Copy link
Contributor

Choose a reason for hiding this comment

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

My personal preference is to ignore the 'line too long' warning. Nothing wrong with going over 79 character lines in my opinion (but we don't have a style guide for functional tests, so entirely up to you)

Copy link
Contributor

Choose a reason for hiding this comment

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

Mention the getdifficulty RPC test in the top level comment or remove the list of tested methods there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding to the comment, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move the def after the _test_getblockheader so it is ordered the same as it is called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, will do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a cleverer way to do this?

@jimmysong jimmysong force-pushed the test_getdifficulty branch from bfd615c to a75c80e Compare April 19, 2017 15:02
@jimmysong
Copy link
Contributor Author

Fixed issues, rebased to master.

@jimmysong jimmysong force-pushed the test_getdifficulty branch 2 times, most recently from 8fd75de to ba2b295 Compare April 19, 2017 15:19
Copy link
Contributor

@paveljanik paveljanik left a comment

Choose a reason for hiding this comment

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

ACK 821dd5e

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

Looks good. Tested ACK ba2b295093d5f5cad4701f9ca86b2c83e60c3ef9.

A few nits which you can take or leave.

Copy link
Contributor

Choose a reason for hiding this comment

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

Might as well fix this docstring while you're at it. The following RPCs are also tested:

  • getbestblockhash
  • getblockhash
  • getblockheader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

My personal preference is to ignore the 'line too long' warning. Nothing wrong with going over 79 character lines in my opinion (but we don't have a style guide for functional tests, so entirely up to you)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer a more descriptive name than res, perhaps difficulty? (or even combine with the line below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

Test added to blockchain.py as adding a new test to reduce test run time.
@jimmysong jimmysong force-pushed the test_getdifficulty branch from ba2b295 to 821dd5e Compare April 19, 2017 21:53
@jimmysong
Copy link
Contributor Author

Fixed nits and squashed.

@laanwj laanwj merged commit 821dd5e into bitcoin:master Apr 21, 2017
laanwj added a commit that referenced this pull request Apr 21, 2017
821dd5e Tests: Add test for getdifficulty (Jimmy Song)

Tree-SHA512: 3da78c4f88efdaab8374582cda606620beb2f1e9a93119a72b67572702c17c36b68c3abf9d466e8c7fb8ba9e8afa9a172e454c553df10d3054f19b3282d3097b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 8, 2019
821dd5e Tests: Add test for getdifficulty (Jimmy Song)

Tree-SHA512: 3da78c4f88efdaab8374582cda606620beb2f1e9a93119a72b67572702c17c36b68c3abf9d466e8c7fb8ba9e8afa9a172e454c553df10d3054f19b3282d3097b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants