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

backport py3 testing enhancements #239

Merged
merged 9 commits into from
Aug 18, 2020
Merged

Conversation

williballenthin
Copy link
Collaborator

backport py3 testing enhancements from #234. basically: wrap py2-only things in xfail annotations.

when we add a py3 backend, then all we need to do is update fixtures::get_extractor() to return the py3 backend on py3 and then re-run the tests. pytest will complain that things that we used to fail no longer fail, so go through and remove those xfail marks.

image

@williballenthin williballenthin added the enhancement New feature or request label Aug 17, 2020
@williballenthin williballenthin requested review from Ana06 and mr-tz August 17, 2020 23:32
@williballenthin
Copy link
Collaborator Author

image
🚀

expected,
scope.__name__,
len(features[feature]),
)
assert len(features[feature]) == expected, msg


def get_extractor(path):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we might want to merge this routine with main.get_extractor() at some point.

Copy link
Collaborator

@mr-tz mr-tz left a comment

Choose a reason for hiding this comment

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

very good!

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

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

LGTM 👍 👍

@@ -57,3 +57,20 @@ jobs:
- name: Run tests
run: pytest tests/

tests38:
Copy link
Member

Choose a reason for hiding this comment

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

This could be done with a matrix for the python version instead of duplicating the code. But as we want to get rid of Python 2 in the near future, I guess this won't have a long life anyway... 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh, good point. though, then the linting would happen twice?

Copy link
Member

@Ana06 Ana06 Aug 21, 2020

Choose a reason for hiding this comment

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

@williballenthin

though, then the linting would happen twice?

no, I meant changing tests to the following (instead of duplicating tests into tests27 and test38:

  tests:
    name: Test in ${{ matrix.python }}
    runs-on: ubuntu-latest
    needs: [code_style, rule_linter]
    strategy:
      matrix:
        include:
          - python: 2.7
          - python: 3.8
    steps:
    - name: Checkout capa with submodules
      uses: actions/checkout@v2
      with:
        submodules: true
    - name: Set up Python ${{ matrix.python }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python }}
    - name: Install capa
      run: pip install -e .[dev]
    - name: Run tests
      run: pytest tests/

I can send a PR as this can be useful if we want to test several python versions.

@williballenthin williballenthin merged commit 5f731f7 into master Aug 18, 2020
@williballenthin williballenthin deleted the backport-py3-fixes branch August 18, 2020 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants