Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Allow custom runxfail #263

Merged
merged 2 commits into from
May 22, 2018
Merged

Allow custom runxfail #263

merged 2 commits into from
May 22, 2018

Conversation

matejcik
Copy link
Contributor

@matejcik matejcik commented May 21, 2018

We can now selectively runxfail certain tests. This is useful for accepting PRs into trezor-core:

  1. trezor-core is going to get a pytest.ini that sets xfail_strict.
    That means that if an xfailed test actually passes, that will break the test suite. So it will be visible when we implement a feature for which tests exist.
  2. To allow PRs to pass the test suite without touching python-trezor directly, we add a new pytest.ini option: run_xfail. This adds a list of markers which will ignore xfail.
    So:
    1. First, the python-trezor PR marks the tests with the name of the feature. This commit already does that: Lisk tests are marked @pytest.mark.lisk, NEMs are @pytest.mark.nem, etc.
      The tests will be also marked with xfail, because the feature is not in core yet.
    2. Then, the trezor-core PR implements the feature, which makes the xfailed tests pass. That breaks the test suite.
    3. To fix the test suite, the core PR also adds a run_xfail to pytest.ini: run_xfail = lisk. (it can take a list: run_xfail = lisk nem stellar)
      That will make the test suite behave as if the tests are not xfailed. If the feature is implemented correctly, the tests will pass.
    4. When the PR is accepted to core, the next step should be a PR to python-trezor that removes the xfails. After that, we should also remove the run_xfail option, just to be tidy.

We can now selectively runxfail certain tests. This is useful for
accepting PRs into trezor-core:

1. trezor-core is going to get a pytest.ini that sets xfail_strict.
   That means that if an `xfail`ed test actually passes, that will
   break the test suite. So it will be visible when we implement
   a feature for which tests exist.
2. To allow PRs to pass the test suite without touching python-trezor
   directly, we add a new pytest.ini option: run_xfail.
   This adds a list of markers which will ignore `xfail`.
   So:
   2.1 First, the python-trezor PR marks the tests with the name
       of the feature. This commit already does that: Lisk tests
       are marked `@pytest.mark.lisk`, NEMs are `@pytest.mark.nem`,
       etc.
       The tests will be also marked with `xfail`, because the
       feature is not in core yet.
   2.2 Then, the trezor-core PR implements the feature, which makes
       the `xfail`ed tests pass. That breaks the test suite.
   2.3 To fix the test suite, the core PR also adds a `run_xfail`
       to `pytest.ini`: `run_xfail = lisk`.
       (it can take a list: `run_xfail = lisk nem stellar`)
       That will make the test suite behave as if the tests are not
       `xfail`ed. If the feature is implemented correctly, the tests
       will pass.
   2.4 When the PR is accepted to core, the next step should be
       a PR to python-trezor that removes the `xfail`s. After that,
       we should also remove the `run_xfail` option, just to be tidy.
@matejcik matejcik requested a review from jpochyla May 21, 2018 15:57
@matejcik matejcik self-assigned this May 21, 2018
@prusnak
Copy link
Member

prusnak commented May 21, 2018 via email

missed Stellar tests, plus Ethereum, for good measure
jpochyla pushed a commit to trezor/trezor-core that referenced this pull request May 22, 2018
@matejcik matejcik merged commit 465c01d into master May 22, 2018
@matejcik matejcik deleted the matejcik/custom-runxfail branch May 22, 2018 15:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants