pytest plugin to test mypy static type analysis

Overview

PyPI GitHub Action Status License License: MIT

pytest-mypy-testing — Plugin to test mypy output with pytest

pytest-mypy-testing provides a pytest plugin to test that mypy produces a given output. As mypy can be told to display the type of an expression this allows us to check mypys type interference.

Installation

python -m pip install pytest-mypy-testing

The Python distribution package contains an entry point so that the plugin is automatically discovered by pytest. To disable the plugin when it is installed , you can use the pytest command line option -p no:mypy-testing.

Writing Mypy Output Test Cases

A mypy test case is a top-level functions decorated with @pytest.mark.mypy_testing in a file named *.mypy-testing or in a pytest test module. pytest-mypy-testing follows the pytest logic in identifying test modules and respects the python_files config value.

Note that pytest-mypy-testing uses the Python ast module to parse candidate files and does not import any file, i.e., the decorator must be exactly named @pytest.mark.mypy_testing.

In a pytest test module file you may combine both regular pytest test functions and mypy test functions. A single function can be both.

Example: A simple mypy test case could look like this:

@pytest.mark.mypy_testing
def mypy_test_invalid_assignment() -> None:
    foo = "abc"
    foo = 123  # E: Incompatible types in assignment (expression has type "int", variable has type "str")

The plugin runs mypy for every file containing at least one mypy test case. The mypy output is then compared to special Python comments in the file:

  • # N: <msg> - we expect a mypy note message
  • # W: <msg> - we expect a mypy warning message
  • # E: <msg> - we expect a mypy error message
  • # R: <msg> - we expect a mypy note message Revealed type is '<msg>'. This is useful to easily check reveal_type output:
    @pytest.mark.mypy_testing
    def mypy_use_reveal_type():
        reveal_type(123)  # N: Revealed type is 'Literal[123]?'
        reveal_type(456)  # R: Literal[456]?

Skipping and Expected Failures

Mypy test case functions can be decorated with @pytest.mark.skip and @pytest.mark.xfail to mark them as to-be-skipped and as expected-to-fail, respectively. As with the @pytest.mark.mypy_testing mark, the names must match exactly as the decorators are extracted from the ast.

Development

  • Create and activate a Python virtual environment.
  • Install development dependencies by calling python -m pip install -U -r requirements.txt.
  • Start developing.
  • To run all tests with tox, Python 3.6, 3.7 and 3.8 must be available. You might want to look into using pyenv.

Changelog

v0.0.7

  • Fix PYTEST_VERSION_INFO - by @blueyed (#8)
  • Always pass --check-untyped-defs to mypy (#11)
  • Respect pytest config python_files when identifying pytest test modules (#12)

v0.0.6 - add pytest 5.4 support

  • Update the plugin to work with pytest 5.4 (#7)

v0.0.5 - CI improvements

  • Make invoke tasks work (partially) on Windows (#6)
  • Add an invoke task to run tox environments by selecting globs (e.g., inv tox -e py-*) (#6)
  • Use coverage directly for code coverage to get more consistent parallel run results (#6)
  • Use flit fork dflit to make packaging work with LICENSES directory (#6)
  • Bump dependencies (#6)
Comments
  • Improve

    Improve "unexpected" failure: include following/extra messages

    It would be useful if following messages would also be displayed in case of mismatches, e.g. with these message (in diff_message_sequences):

    (Pdb++) pp actual_messages
    [Message(filename='…/test_typing.py', lineno=1, colno=1, severity=<Severity.ERROR: 3>, message="No library stub file for module 'foo'"),
     Message(filename='…/test_typing.py', lineno=1, colno=1, severity=<Severity.NOTE: 1>, message='(Stub files are from https://github.com/python/typeshed)'),
     Message(filename='…/test_typing.py', lineno=7, colno=11, severity=<Severity.ERROR: 3>, message='Incompatible types in assignment (expression has type "int", variable has type "str")')]
    (Pdb++) expected_messages
    [Message(filename='…/test_typing.py', lineno=7, colno=None, severity=<Severity.ERROR: 3>, message='Incompatible types in assignment (expression has type "int", variable has type "str")')]
    

    You only see:

    ============ FAILURES ============
    ___ [mypy]mypy_use_reveal_type ___
    …/test_typing.py:1: note (unexpected): (Stub files are from https://github.com/python/typeshed)
    

    So the actual message is there already, but only after initial error/notes.

    opened by blueyed 5
  • Some messages not found when running pytest as `python -m pytest` against mypy 0.971

    Some messages not found when running pytest as `python -m pytest` against mypy 0.971

    I don't think this is enough information to be actionable, but I hope I'm wrong, and I need some feedback on where to look next.

    My typing tests started failing under mypy 0.971; reverting to 0.961 fixed the issue. All of the failures took the form of an expected message not being present. I was unable to replicate this issue in a small test file, but if I moved that file into the test folder, it exhibited the issue, even if tested individually.

    Things that make the issue go away:

    • Invoking pytest with pytest instead of python -m pytest
    • Downgrading mypy to 0.961
    • Testing the same file in a different tree (?)

    Things that don't make the issue go away:

    • Collecting only a subset of test files

    Of note, if I just collect the small test file, in the main tree (so I can hit the issue), then invoking python -m pytest (which hits the issue) completes in 0.05s pretty consistently, while invoking pytest (which does not) tends to take over 7s.

    I was poking around trying to replicate things, and I can't see any significant difference in the output from mypy.api.run between versions.

    I wish I had more to go on here, but that's what I've found so far.

    opened by mwchase 4
  • Problem using plugin on Windows?

    Problem using plugin on Windows?

    Ran into a problem with running this on windows. Im not entirely sure whats special about my setup that would cause this.

    Relevant line from attached error message

    line = "C:\\Users\\eehusky\\anaconda3\\lib\\site-packages\\_pytest\\_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
    
        @classmethod
        def from_output(cls, line: str) -> "Message":
            m = cls.OUTPUT_RE.match(line)
            if not m:
    >           raise ValueError("Not a valid mypy message")
    E           ValueError: Not a valid mypy message
    

    Brass tacks, It think the entire absolute path getting included and is messing with the regex.

    I think it is getting hung up on the C: in the file path in mypy messages. But I am by no means a regex guru so Ill withhold judgement.

    OUTPUT_RE = re.compile(
            r"^(?P<fname>[^:]+):"   # << This 
            r"(?P<lineno>[0-9]+):"
            r"((?P<colno>[0-9]+):)?"
            r" *(?P<severity>(error|note|warning)):"
            r"(?P<message>.*)$"
        )
    

    I did mess around with this a bit and found if i removed the C: from the text it would work fine.

    import os
    import re
    OUTPUT_RE = re.compile(
            r"^(?P<fname>[^:]+):"
            r"(?P<lineno>[0-9]+):"
            r"((?P<colno>[0-9]+):)?"
            r" *(?P<severity>(error|note|warning)):"
            r"(?P<message>.*)$"
        )
    
    def from_output(line: str) -> "Message":
        m = OUTPUT_RE.match(line)
        if not m:
            raise ValueError("Not a valid mypy message")
        return (
            os.path.abspath(m.group("fname")),
            int(m.group("lineno")),
            int(m.group("colno")) if m.group("colno") else None,
            m.group("severity").upper(),
            m.group("message").strip(),
        )
    
    
    line = "C/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
    print(from_output(line))
    line = "C:/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
    print(from_output(line))
    

    Output from above test

    ('C:\\Users\\eehusky\\anaconda3\\lib\\site-packages\\_pytest\\_argcomplete.py', 103, 1, 'ERROR', "Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs")
    ----------------------------------------------------------------------
    ValueError                           Traceback (most recent call last)
    <ipython-input-17-f28f32de0f3a> in <module>
         25 print(from_output(line))
         26 line = "C:/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
    ---> 27 print(from_output(line))
    
    <ipython-input-17-f28f32de0f3a> in from_output(line)
         12     m = OUTPUT_RE.match(line)
         13     if not m:
    ---> 14         raise ValueError("Not a valid mypy message")
         15     return (
         16         os.path.abspath(m.group("fname")),
    
    ValueError: Not a valid mypy message
    

    Cheers, -Brandon

    output.txt

    opened by eehusky 2
  • Disable soft error limit

    Disable soft error limit

    Especially with --no-silence-site-packages newer versions of mypy can produce a number of errors that's over the soft error limit which defaults to 200. By setting it to -1, we disable it, which makes sense for something as predictable as a diff of expected vs. actual errors.

    (Not sure why we have --no-silence-site-packages in the arguments, but that's a separate question.)

    opened by ikonst 1
  • Bump py from 1.8.1 to 1.10.0

    Bump py from 1.8.1 to 1.10.0

    Bumps py from 1.8.1 to 1.10.0.

    Changelog

    Sourced from py's changelog.

    1.10.0 (2020-12-12)

    • Fix a regular expression DoS vulnerability in the py.path.svnwc SVN blame functionality (CVE-2020-29651)
    • Update vendored apipkg: 1.4 => 1.5
    • Update vendored iniconfig: 1.0.0 => 1.1.1

    1.9.0 (2020-06-24)

    • Add type annotation stubs for the following modules:

      • py.error
      • py.iniconfig
      • py.path (not including SVN paths)
      • py.io
      • py.xml

      There are no plans to type other modules at this time.

      The type annotations are provided in external .pyi files, not inline in the code, and may therefore contain small errors or omissions. If you use py in conjunction with a type checker, and encounter any type errors you believe should be accepted, please report it in an issue.

    1.8.2 (2020-06-15)

    • On Windows, py.path.locals which differ only in case now have the same Python hash value. Previously, such paths were considered equal but had different hashes, which is not allowed and breaks the assumptions made by dicts, sets and other users of hashes.
    Commits
    • e5ff378 Update CHANGELOG for 1.10.0
    • 94cf44f Update vendored libs
    • 5e8ded5 testing: comment out an assert which fails on Python 3.9 for now
    • afdffcc Rename HOWTORELEASE.rst to RELEASING.rst
    • 2de53a6 Merge pull request #266 from nicoddemus/gh-actions
    • fa1b32e Merge pull request #264 from hugovk/patch-2
    • 887d6b8 Skip test_samefile_symlink on pypy3 on Windows
    • e94e670 Fix test_comments() in test_source
    • fef9a32 Adapt test
    • 4a694b0 Add GitHub Actions badge to README
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump jinja2 from 2.11.2 to 2.11.3

    Bump jinja2 from 2.11.2 to 2.11.3

    Bumps jinja2 from 2.11.2 to 2.11.3.

    Release notes

    Sourced from jinja2's releases.

    2.11.3

    This contains a fix for a speed issue with the urlize filter. urlize is likely to be called on untrusted user input. For certain inputs some of the regular expressions used to parse the text could take a very long time due to backtracking. As part of the fix, the email matching became slightly stricter. The various speedups apply to urlize in general, not just the specific input cases.

    Changelog

    Sourced from jinja2's changelog.

    Version 2.11.3

    Released 2021-01-31

    • Improve the speed of the urlize filter by reducing regex backtracking. Email matching requires a word character at the start of the domain part, and only word characters in the TLD. :pr:1343
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Cannot get README example to pass

    Cannot get README example to pass

    Hi I'm trying to get started with using your project, but I can't even get a simple test to pass.

    $ pytest --verbose
    ======================================= test session starts =======================================
    platform linux -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /home/user/.virtualenvs/virtualenv_name/bin/python
    cachedir: .pytest_cache
    rootdir: /home/user/project, inifile: pytest.ini
    plugins: mypy-testing-0.0.6
    collected 1 item                                                                                  
    
    tests/test_example.py::[mypy]mypy_test_invalid_assginment FAILED                            [100%]
    
    ============================================ FAILURES =============================================
    _______________________________ [mypy]mypy_test_invalid_assginment ________________________________
    /home/user/project/tests/test_example.py:7: error (missing): Incompatible types in assignment (expression has type "int", variable has type "str")
    ======================================== warnings summary =========================================
    tests/test_example.py::[mypy]mypy_test_invalid_assginment
      /home/user/.virtualenvs/virtualenv_name/lib/python3.8/distutils/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
        import imp
    
    -- Docs: https://docs.pytest.org/en/latest/warnings.html
    ===================================== short test summary info =====================================
    FAILED tests/test_example.py::[mypy]mypy_test_invalid_assginment - 
    ================================== 1 failed, 1 warning in 1.26s ===================================
    

    where my test file contains just the example from the README:

    import pytest  # type: ignore
    
    
    @pytest.mark.mypy_testing
    def mypy_test_invalid_assginment():
        foo = "abc"
        foo = 123  # E: Incompatible types in assignment (expression has type "int", variable has type "str")
    

    Am I missing something vital to use this project?

    opened by BryceBeagle 1
  • Fix PYTEST_VERSION_INFO

    Fix PYTEST_VERSION_INFO

    It currently fails with editable pytest installations (due to setuptools-scm version):

    PYTEST_VERISON_INFO = tuple(int(part) for part in PYTEST_VERSION.split("."))
    ValueError: invalid literal for int() with base 10: 'dev42+g134a7d26d'
    
    opened by blueyed 0
  • Bump setuptools from 65.3.0 to 65.5.1

    Bump setuptools from 65.3.0 to 65.5.1

    Bumps setuptools from 65.3.0 to 65.5.1.

    Changelog

    Sourced from setuptools's changelog.

    v65.5.1

    Misc ^^^^

    • #3638: Drop a test dependency on the mock package, always use :external+python:py:mod:unittest.mock -- by :user:hroncok
    • #3659: Fixed REDoS vector in package_index.

    v65.5.0

    Changes ^^^^^^^

    • #3624: Fixed editable install for multi-module/no-package src-layout projects.
    • #3626: Minor refactorings to support distutils using stdlib logging module.

    Documentation changes ^^^^^^^^^^^^^^^^^^^^^

    • #3419: Updated the example version numbers to be compliant with PEP-440 on the "Specifying Your Project’s Version" page of the user guide.

    Misc ^^^^

    • #3569: Improved information about conflicting entries in the current working directory and editable install (in documentation and as an informational warning).
    • #3576: Updated version of validate_pyproject.

    v65.4.1

    Misc ^^^^

    v65.4.0

    Changes ^^^^^^^

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump wheel from 0.37.1 to 0.38.1

    Bump wheel from 0.37.1 to 0.38.1

    Bumps wheel from 0.37.1 to 0.38.1.

    Changelog

    Sourced from wheel's changelog.

    Release Notes

    UNRELEASED

    • Updated vendored packaging to 22.0

    0.38.4 (2022-11-09)

    • Fixed PKG-INFO conversion in bdist_wheel mangling UTF-8 header values in METADATA (PR by Anderson Bravalheri)

    0.38.3 (2022-11-08)

    • Fixed install failure when used with --no-binary, reported on Ubuntu 20.04, by removing setup_requires from setup.cfg

    0.38.2 (2022-11-05)

    • Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with multiple platform tags

    0.38.1 (2022-11-04)

    • Removed install dependency on setuptools
    • The future-proof fix in 0.36.0 for converting PyPy's SOABI into a abi tag was faulty. Fixed so that future changes in the SOABI will not change the tag.

    0.38.0 (2022-10-21)

    • Dropped support for Python < 3.7
    • Updated vendored packaging to 21.3
    • Replaced all uses of distutils with setuptools
    • The handling of license_files (including glob patterns and default values) is now delegated to setuptools>=57.0.0 (#466). The package dependencies were updated to reflect this change.
    • Fixed potential DoS attack via the WHEEL_INFO_RE regular expression
    • Fixed ValueError: ZIP does not support timestamps before 1980 when using SOURCE_DATE_EPOCH=0 or when on-disk timestamps are earlier than 1980-01-01. Such timestamps are now changed to the minimum value before packaging.

    0.37.1 (2021-12-22)

    • Fixed wheel pack duplicating the WHEEL contents when the build number has changed (#415)
    • Fixed parsing of file names containing commas in RECORD (PR by Hood Chatham)

    0.37.0 (2021-08-09)

    • Added official Python 3.10 support
    • Updated vendored packaging library to v20.9

    ... (truncated)

    Commits
    • 6f1608d Created a new release
    • cf8f5ef Moved news item from PR #484 to its proper place
    • 9ec2016 Removed install dependency on setuptools (#483)
    • 747e1f6 Fixed PyPy SOABI parsing (#484)
    • 7627548 [pre-commit.ci] pre-commit autoupdate (#480)
    • 7b9e8e1 Test on Python 3.11 final
    • a04dfef Updated the pypi-publish action
    • 94bb62c Fixed docs not building due to code style changes
    • d635664 Updated the codecov action to the latest version
    • fcb94cd Updated version to match the release
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump certifi from 2022.9.14 to 2022.12.7

    Bump certifi from 2022.9.14 to 2022.12.7

    Bumps certifi from 2022.9.14 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Handle mypy error codes

    Handle mypy error codes

    Recent versions of mypy added string error codes next to the messages. I don't remember seeing this in older versions.

    If you have older pytest-mypy-testing assertions you have two options:

    • Adjust all assertion messages
    • Use "hide_error_codes = True" to make them still pass.

    It would be nice if this plugin would parse the message from mypy and allow matching based on error codes. Stability is not guaranteed but they're still likely to be more stable that messages. The fact that error codes are short strings would also alleviate #29.

    opened by cdleonard 0
  • new release required for recent pytest release

    new release required for recent pytest release

    Seeing the following error in my CI tests:

        File "/tmp/.tox/py310-macos/lib/python3.10/site-packages/pytest_mypy_testing/plugin.py", line 12, in <module>
          from py._path.local import LocalPath
      ModuleNotFoundError: No module named 'py._path'; 'py' is not a package
    

    looks like the changes from https://github.com/davidfritzsche/pytest-mypy-testing/pull/27 would fix it. any plans for a new version release?

    thanks!

    opened by tlambert03 0
  • Handling of long lines

    Handling of long lines

    In certain cases, we have a mypy assertion like:

    @pytest.mark.mypy_testing
    def test_foo():
        link = Link()
        link1.url = 123  # E: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")
    

    However, the last line already covers 122-characters. When using Black (which has a default of 88 chars - reference), it'd turn something like:

    @pytest.mark.mypy_testing
    def test_foo():
        link = Link()
        link1.url = (
            123
        )  # E: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")
    

    The issue with this new format is that pytest would error out with something like:

    5: error (unexpected): Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")
    6: error (missing): Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")
    

    Perhaps there should be another interface that could help declare the assertions aside from comments? or maybe, it should be possible to breakdown the comments into multi-line chunks?

    opened by BurnzZ 0
Releases(v0.0.7)
Owner
David Fritzsche
David Fritzsche
A simple script to login into twitter using Selenium in python.

Quick Talk A simple script to login into twitter using Selenium in python. I was looking for a way to login into twitter using Selenium in python. Sin

Lzy-slh 4 Nov 20, 2022
Python Rest Testing

pyresttest Table of Contents What Is It? Status Installation Sample Test Examples Installation How Do I Use It? Running A Simple Test Using JSON Valid

Sam Van Oort 1.1k Dec 28, 2022
A collection of benchmarking tools.

Benchmark Utilities About A collection of benchmarking tools. PYPI Package Table of Contents Using the library Installing and using the library Manual

Kostas Georgiou 2 Jan 28, 2022
This is a bot that can type without any assistance and have incredible speed.

BulldozerType This is a bot that can type without any assistance and have incredible speed. This bot currently only works on the site https://onlinety

1 Jan 03, 2022
FaceBot is a script to automatically create a facebook account using the selenium and chromedriver modules.

FaceBot is a script to automatically create a facebook account using the selenium and chromedriver modules. That way, we don't need to input full name, email and password and date of birth. All will

Fadjrir Herlambang 2 Jun 17, 2022
Pytest modified env

Pytest plugin to fail a test if it leaves modified os.environ afterwards.

wemake.services 7 Sep 11, 2022
Mypy static type checker plugin for Pytest

pytest-mypy Mypy static type checker plugin for pytest Features Runs the mypy static type checker on your source files as part of your pytest test run

Dan Bader 218 Jan 03, 2023
A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.

PyAutoGUI PyAutoGUI is a cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard. pip inst

Al Sweigart 7.5k Dec 31, 2022
Automatically mock your HTTP interactions to simplify and speed up testing

VCR.py 📼 This is a Python version of Ruby's VCR library. Source code https://github.com/kevin1024/vcrpy Documentation https://vcrpy.readthedocs.io/ R

Kevin McCarthy 2.3k Jan 01, 2023
A configurable set of panels that display various debug information about the current request/response.

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

Jazzband 7.3k Jan 02, 2023
A folder automation made using Watch-dog, it only works in linux for now but I assume, it will be adaptable to mac and PC as well

folder-automation A folder automation made using Watch-dog, it only works in linux for now but I assume, it will be adaptable to mac and PC as well Th

Parag Jyoti Paul 31 May 28, 2021
Headless chrome/chromium automation library (unofficial port of puppeteer)

Pyppeteer Pyppeteer has moved to pyppeteer/pyppeteer Unofficial Python port of puppeteer JavaScript (headless) chrome/chromium browser automation libr

miyakogi 3.5k Dec 30, 2022
bulk upload files to libgen.lc (Selenium script)

LibgenBulkUpload bulk upload files to http://libgen.lc/librarian.php (Selenium script) Usage ./upload.py to_upload uploaded rejects So title and autho

8 Jul 07, 2022
A Modular Penetration Testing Framework

fsociety A Modular Penetration Testing Framework Install pip install fsociety Update pip install --upgrade fsociety Usage usage: fsociety [-h] [-i] [-

fsociety-team 802 Dec 31, 2022
Automated testing tool developed in python for Advanced mathematical operations.

Advanced-Maths-Operations-Validations Automated testing tool developed in python for Advanced mathematical operations. Requirements Python 3.5 or late

Nikhil Repale 1 Nov 16, 2021
Find index entries in $INDEX_ALLOCATION attributes

INDXRipper Find index entries in $INDEX_ALLOCATION attributes Timeline created using mactime.pl on the combined output of INDXRipper and fls. See: sle

32 Nov 05, 2022
Pynguin, The PYthoN General UnIt Test geNerator is a test-generation tool for Python

Pynguin, the PYthoN General UnIt test geNerator, is a tool that allows developers to generate unit tests automatically.

Chair of Software Engineering II, Uni Passau 997 Jan 06, 2023
The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).

mamba: the definitive test runner for Python mamba is the definitive test runner for Python. Born under the banner of behavior-driven development. Ins

Néstor Salceda 502 Dec 30, 2022
A Django plugin for pytest.

Welcome to pytest-django! pytest-django allows you to test your Django project/applications with the pytest testing tool. Quick start / tutorial Chang

pytest-dev 1.1k Dec 31, 2022
This is a simple software for fetching new changes to remote repositories automatically.

Git Autofetch Git Autofetch is a simple software for fetching new changes from a repo to local repositories after a set time interval. This program is

Shreyas Ashtamkar 10 Jul 21, 2022