<p><a href="https://github.com/bitcoin/bitcoin/pull/8836" rel="nofollow noreferrer">PR #8836</a> was one of John Newbery's earlier contributions to Bitcoin Core. He introduced this code so that <a href="https://github.com/bitcoin/bitcoin/blob/master/test/util/bitcoin-util-test.py" rel="nofollow noreferrer">bitcoin-util-test.py</a> would fail when the <code>output_cmp</code> file is empty.</p>
<pre><code>if not outputData:
            print(&quot;Output data missing for &quot; + outputFn)
            sys.exit(1)
</code></pre>
<p><a href="https://github.com/bitcoin/bitcoin/pull/16445" rel="nofollow noreferrer">PR #16445</a> was Fabian Jahr's first contribution to Bitcoin Core. One particular test (checking that an unknown message type would result in a disconnect) had been highlighted as flaky on MacOS and so Fabian wrote some code to wrap the test in an if, else statement so that it would be skipped when on MacOS.</p>
<pre><code>if sys.platform != 'darwin':
.....
.....
else: 
    self.log.info(&quot;Skipping test p2p_invalid_messages/1 (oversized message) under macOS&quot;)
</code></pre>
<p><a href="https://github.com/bitcoin/bitcoin/pull/20023" rel="nofollow noreferrer">PR #20023</a> wasn't a first contribution but was a neat contribution nonetheless. theStack used <a href="https://pypi.org/project/vulture/" rel="nofollow noreferrer">vulture</a> via the following script to find constants in the functional tests that aren't used anymore.</p>
<pre><code>#!/bin/sh
for F in $(git ls-files -- &quot;*.py&quot;); do vulture &quot;$F&quot; | grep &quot;unused variable&quot;; done
</code></pre>

CC BY-SA 4.0
2020-09-26T19:59:44.407Z
2020-09-28T17:59:14.523Z
2020-09-28T17:59:14.523Z
Michael Folkson
<p>I have heard that improving the Bitcoin Core tests is a good way to start contributing to Bitcoin Core. What are some good examples of previous first contributions to the tests to take some inspiration from?</p>

<bitcoin-core-development><testing><functional-test><unit-test>
What are some examples of previous first contributions improving Bitcoin Core tests?
Michael Folkson
# What are some examples of previous first contributions improving Bitcoin Core tests?

(Asked by: username_0 on 2020-09-26)

I have heard that improving the Bitcoin Core tests is a good way to start contributing to Bitcoin Core. What are some good examples of previous first contributions to the tests to take some inspiration from?

**Tags:** bitcoin-core-development, testing, functional-test, unit-test


---

## 1 answers

### Answer by username_0 on 2020-09-26. Score: 1 | Accepted answer

[PR #8836](https://github.com/bitcoin/bitcoin/pull/8836) was one of John Newbery's earlier contributions to Bitcoin Core. He introduced this code so that [bitcoin-util-test.py](https://github.com/bitcoin/bitcoin/blob/master/test/util/bitcoin-util-test.py) would fail when the `output_cmp` file is empty.

```
if not outputData:
            print("Output data missing for " + outputFn)
            sys.exit(1)

```

[PR #16445](https://github.com/bitcoin/bitcoin/pull/16445) was Fabian Jahr's first contribution to Bitcoin Core. One particular test (checking that an unknown message type would result in a disconnect) had been highlighted as flaky on MacOS and so Fabian wrote some code to wrap the test in an if, else statement so that it would be skipped when on MacOS.

```
if sys.platform != 'darwin':
.....
.....
else: 
    self.log.info("Skipping test p2p_invalid_messages/1 (oversized message) under macOS")

```

[PR #20023](https://github.com/bitcoin/bitcoin/pull/20023) wasn't a first contribution but was a neat contribution nonetheless. theStack used [vulture](https://pypi.org/project/vulture/) via the following script to find constants in the functional tests that aren't used anymore.

```
#!/bin/sh
for F in $(git ls-files -- "*.py"); do vulture "$F" | grep "unused variable"; done

```


---

