Ward is a modern test framework for Python with a focus on productivity and readability.

Overview

Ward

Codecov Documentation Status PyPI version All Contributors

Ward is a modern test framework for Python with a focus on productivity and readability.

image

Features

See the full set of features in the documentation.

Descriptive test names: describe what your tests do using strings, not function names.

@test("1 + 2 == 3")
def _():
    assert 1 + 2 == 3

Modular test dependencies: manage test setup/teardown code using fixtures that rely on Python's import system, not name matching.

@fixture
def user():
    return User(name="darren")
    
@test("the user is called darren")
def _(u=user):
    assert u.name == "darren"

Support for asyncio: define your tests and fixtures with async def and call asynchronous code within them.

@fixture
async def user():
    u = await create_user()
    return await u.login()

@test("the logged in user has a last session date")
async def _(user=user):
    last_session = await get_last_session_date(user.id)
    assert is_recent(last_session, get_last_session_date)

Powerful test selection: limit your test run not only by matching test names/descriptions, but also on the code contained in the body of the test.

ward --search "Database.get_all_users"

Or use tag expressions for more powerful filtering.

ward --tags "(unit or integration) and not slow"

Parameterised testing: write a test once, and run it multiple times with different inputs by writing it in a loop.

  for lhs, rhs, res in [
      (1, 1, 2),
      (2, 3, 5),
  ]:
      @test("simple addition")
      def _(left=lhs, right=rhs, result=res):
          assert left + right == result

Cross platform: Tested on Mac OS, Linux, and Windows.

Zero config: Sensible defaults mean running ward with no arguments is enough to get started. Can be configured using pyproject.toml or the command line if required.

Colourful, human readable output: quickly pinpoint and fix issues with detailed output for failing tests.

Getting Started

Take a look at the "Getting Started" tutorial.

How to Contribute

Contributions are very welcome and encouraged!

See the contributing guide for information on how you can take part in the development of Ward.

Contributors

Thanks goes to these wonderful people (emoji key):


Darren Burns

💻 📖 🤔 👀 🐛 💡

khusrokarim

🤔 💻 🐛

Alec Jordan

💻

Jason C. McDonald

💻 🤔

Andy Kluger

💻 🤔

thebigmunch

💻

Tyler Couto

💻

Thibaut Le Page

💻

Dorian Czichotzki

💻 🤔

jayesh hathila

💻

Mandar Vaze

💻

Josh Karpel

💻

Andreas Lutro

💻

Oleg Höfling

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • Add progress trackers during test execution

    Add progress trackers during test execution

    Here's a take on https://github.com/darrenburns/ward/discussions/197 , using a Rich progress bar displayed below the running tests.

    Putting this up for an early look (@darrenburns) because there are a few problems with it that might need discussion...

    • Ward's own suite is so fast that you can barely see the progress bar appear, at least on my terminal 🤪 . I've taken to adding a sleep right here so that I can actually see it while playing around...
    • It flickers pretty badly (at least on my terminal...).
    • I don't think it is compatible with either of the dots output displays, because it seems like Progress is expecting you to not print with end="" while it's running. Perhaps we can make some improvements to Rich itself to make that work better.
    opened by JoshKarpel 20
  • Add pretty output for all comparison failures

    Add pretty output for all comparison failures

    Following up on https://github.com/darrenburns/ward/pull/242 , this PR is a take on:

    • Introducing pretty output for all comparison failures, in the same titled-panel style we landed on in the other PR.
    • Introducing a consistent, extensible way to generate and combine parts of the comparison failure pretty output (it is very easy to add/change parts in the source, and should hopefully be easy to hookify it).
    • Revising the existing == output to use the titled-panel style.

    Incidentally, I extended the output to include assertion messages if present, and allowed for assertion messages that aren't plain strings.

    Here's what it looks like right now on this example: test_examples.txt:

    image

    I decided to make the two operands be displayed side-by-side to save vertical space on wide terminals. If the terminal is narrow, Rich will automatically stack them vertically instead!

    image

    opened by JoshKarpel 13
  • Add tagging separate from string descriptions

    Add tagging separate from string descriptions

    There is a clear distinction between describing a test and classifying it. They are semantically different things. The current method of 'tagging' or 'marking' tests is by patterns in the string descriptions. This not only mixes two things that probably shouldn't be but also causes some usability issues.

    Even just a couple 'tags' can drown out the test descriptions, especially since they have to be formatted for reliable parsing for text search. They don't end up looking great in the output as the tags don't line up for easy human parsing. As alluded to before, text searching is clunky at best or unreliable.

    So, I suggest adding a tags or similar attribute to tests and parameter to the test decorator to supplant the idea of tagging the descriptions. The --search CLI option could remain for text searching the descriptions, but a new --tags (or whatever name is chosen) option could be added. An implementation detail that would need to be ironed out is whether to support both 'or' and 'and' cases as well as how for multiple tags.

    enhancement idea/discussion 
    opened by thebigmunch 12
  • Add new result writers

    Add new result writers

    It might be nice to have a JSON writer if this is part of a pipeline. It might also be nice to have a non-colored output. Currently the fields are easy to see on a colored terminal, because they're different colors. However, in some cases (maybe in Jenkins) you may not have access to colors, so it'd be easier to read with clear separators and no color codes.

    enhancement idea/discussion 
    opened by onlyanegg 11
  • Ignore virtualenv folders when searching for tests? Ignore folders in .gitignore?

    Ignore virtualenv folders when searching for tests? Ignore folders in .gitignore?

    This was discovered after merging #80, which adds a Makefile which creates a venv inside the project directory. During test collection, ward recurses directories and may stumble across test modules not intended for it. Looking inside the virtualenv caused ward to fail. Running ward --path tests worked because it excluded the virtualenv from test collection.

    Screenshot 2020-01-19 at 00 56 48

    I'm wondering whether it makes sense for ward to ignore virtualenvs or folders in the .gitignore when it looks for tests?

    enhancement idea/discussion 
    opened by darrenburns 11
  • Include location footer in logs for AssertionErrors

    Include location footer in logs for AssertionErrors

    Changes:

    1. Adding Location footer in AssertionErrors.
    

    Concerns:

    1. Didn't add tests for the change as I can't find other tests for the Locations.
    2. Approach doesn't seem clean to me, not sure if how we can improve it.
    

    issue #126

    opened by jayeshathila 8
  • ditch the setup.py for a flit-flavored pyproject.toml

    ditch the setup.py for a flit-flavored pyproject.toml

    If you're interested in switching from setup.py to pyproject.toml (with flit), take a look. I thought this might be a good step toward #68.

    Notes:

    • flit looks for a project description at the start of __init__.py, so I moved it there
    • I added a dev-requirements.txt though I don't know if you want that
    • Someone with Windows would have to test if a workaround is still necessary here ("Work around encoding errors when installing on Windows." from setup.py)
    • I don't know if you want to relax the dev dependency versions, if you want to keep them at all
    opened by AndydeCleyre 8
  • Add `live` progress style and refactor output and progress styles

    Add `live` progress style and refactor output and progress styles

    Putting this up for some early feedback. Have not tested all the corner cases of #205 yet.

    @darrenburns I did what I described in #227 and it works great! I think I came up with a fairly clean way of abstracting away the actual test running while giving the styles a fair bit of control over what the output looks like. I've got the "live" output style you describe in the issue, plus a "none" output style that prints nothing, PLUS dots work with progress bars! Some of these are even a little faster in wall clock time because more of the printing is happening on a background thread.

    ... but none of them will work in CI except test-per-line output with inline progress, because the others all use Lives. In fact, since I'm always starting the live right now, it may mess up CI even with the components that would use it turned off....

    opened by JoshKarpel 7
  • Add pre-commit

    Add pre-commit

    Threw this together re: https://github.com/darrenburns/ward/discussions/214#discussioncomment-767992 , since I guess I have Opinions about which hooks to use 😛

    Depends on #217 to actually pass...

    @darrenburns if you want to use pre-commit.ci , can you opt-in at https://pre-commit.ci/ ? It should work, since this branch has a .pre-commit-config.yaml. If you don't want to use the external service, we can set up the checks as a GitHub Actions workflow.

    WIP...

    opened by JoshKarpel 7
  • Add information from tests to `ward fixtures`

    Add information from tests to `ward fixtures`

    So, this turned into a doozy. I think it's ready for a round of review.

    Addresses #159

    • Test and Fixture are now hashable. This was a little tricky for Fixture, since it seems like the underlying function's hash is different in different places (I suspect this is because they aren't actually the same function when inside the Suite because of assertion rewriting?).
    • Test now has a helper class, TestArgumentResolver, where are all of the methods that make that happen are stored. I actually didn't really need to modify them at all, although I changed how information flows through them a little and added a helper method to get fixture arguments. This made the rest of the logic a little easier for me to grok and provides an obvious place to hang more code in the future. More data could be passed to the resolver directly to lessen the amount of self.test.<whatever> going on in it.
    • ward fixtures can now display three kinds of dependency information: parent fixtures, child fixtures, and direct test usages. Parents and children can be displayed as trees.
    • Rewrote most of the fixture information display from #154 to accommodate the new functionality.
    opened by JoshKarpel 7
  • ModuleNotFoundError/ImportError within ward

    ModuleNotFoundError/ImportError within ward

    I have ward installed in a virtual environment on Python 3.7.5, and I'm getting the following error when executing the ward command in the root of my repository. My code lives in a package omission directly in this repository, and that package contains subpackages and submodules configured as tests.

    Here are the versions of the packages installed in my virtual environment:

    • GitPython-3.1.0
    • PyYAML-5.3.1
    • appdirs-1.4.3
    • bandit-1.6.2
    • click-7.1.1
    • colorama-0.3.9
    • cucumber-tag-expressions-2.0.4
    • entrypoints-0.3
    • flake8-3.7.9
    • gitdb-4.0.2
    • mccabe-0.6.1
    • pbr-5.4.4
    • pprintpp-0.4.0
    • pycodestyle-2.5.0
    • pyflakes-2.1.1
    • pygments-2.6.1
    • pyside2-5.14.1
    • shiboken2-5.14.1
    • six-1.14.0
    • smmap-3.0.1
    • stevedore-1.32.0
    • termcolor-1.1.0
    • toml-0.9.6
    • ward-0.42.0b0

    Here's the error I'm encountering:

    (venv) jason@tardis:omission$ ward
    Traceback (most recent call last):
      File "/home/jason/Code/Repositories/omission/venv/bin/ward", line 10, in <module>
        sys.exit(run())
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/run.py", line 115, in run
        modules = list(load_modules(mod_infos))
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/collect.py", line 109, in load_modules
        m.__loader__.exec_module(m)
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "venv/lib/python3.7/site-packages/git/test/test_diff.py", line 7, in <module>
        import ddt
    ModuleNotFoundError: No module named 'ddt'
    

    After installing ddt manually (ddt-1.3.1), I get this error instead when running ward:

    Traceback (most recent call last):
      File "/home/jason/Code/Repositories/omission/venv/bin/ward", line 10, in <module>
        sys.exit(run())
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/run.py", line 115, in run
        modules = list(load_modules(mod_infos))
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/collect.py", line 109, in load_modules
        m.__loader__.exec_module(m)
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "venv/lib/python3.7/site-packages/git/test/performance/test_commit.py", line 11, in <module>
        from .lib import TestBigRepoRW
    ImportError: attempted relative import with no known parent package
    

    Interestingly, if I install pytest as well, the error on ward changes yet again:

    Traceback (most recent call last):
      File "/home/jason/Code/Repositories/omission/venv/bin/ward", line 10, in <module>
        sys.exit(run())
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/run.py", line 115, in run
        modules = list(load_modules(mod_infos))
      File "/home/jason/Code/Repositories/omission/venv/lib/python3.7/site-packages/ward/collect.py", line 109, in load_modules
        m.__loader__.exec_module(m)
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "venv/lib/python3.7/site-packages/importlib_metadata/tests/test_api.py", line 5, in <module>
        from . import fixtures
    ImportError: attempted relative import with no known parent package
    

    For the record, installing pytest as well installs the following:

    • attrs-19.3.0
    • importlib-metadata-1.6.0
    • more-itertools-8.2.0
    • packaging-20.3
    • pluggy-0.13.1
    • py-1.8.1
    • pyparsing-2.4.6
    • pytest-5.4.1
    • wcwidth-0.1.9
    • zipp-3.1.0
    bug 
    opened by CodeMouse92 7
  • Request: relax upper bounds on dependency: rich

    Request: relax upper bounds on dependency: rich

    This may be something to think about for more than just rich, but rich in particular is:

    1. seeing rapid development and releases
    2. used by a whole lot of projects (which may be co-installed with ward)

    Currently ward prohibits installation of the newest rich releases, which means if a project is requiring that new version of rich, an older version of ward must be used, which doesn't restrict the rich version as much.

    But this doesn't actually improve compatibility -- in fact it creates a cascading effect of installing/requiring older versions of more tools, increasing probability of in-practice incompatibility (as opposed to explicitly version-specified incompatibility) between new PyPI releases and very old ones.

    See also:

    • #323
    • https://github.com/darrenburns/ward/issues/300#issuecomment-1371304154
    opened by AndydeCleyre 0
  • Bump actions/setup-python from 4.0.0 to 4.4.0

    Bump actions/setup-python from 4.0.0 to 4.4.0

    Bumps actions/setup-python from 4.0.0 to 4.4.0.

    Release notes

    Sourced from actions/setup-python's releases.

    Add support to install multiple python versions

    In scope of this release we added support to install multiple python versions. For this you can try to use this snippet:

        - uses: actions/setup-python@v4
          with:
            python-version: |
                3.8
                3.9
                3.10
    

    Besides, we changed logic with throwing the error for GHES if cache is unavailable to warn (actions/setup-python#566).

    Improve error handling and messages

    In scope of this release we added improved error message to put operating system and its version in the logs (actions/setup-python#559). Besides, the release

    v4.3.0

    • Update @​actions/core to 1.10.0 version #517
    • Update @​actions/cache to 3.0.4 version #499
    • Only use github.token on github.com #443
    • Improvement of documentation #477 #479 #491 #492

    Add check-latest input and bug fixes

    In scope of this release we add the check-latest input. If check-latest is set to true, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the version will then be downloaded from python-versions repository. By default check-latest is set to false. For PyPy it will to try to reach https://downloads.python.org/pypy/versions.json

    Example of usage:

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.9'
          check-latest: true
      - run: python --version
    

    Besides, it includes such changes as

    v4.1.0

    In scope of this pull request we updated actions/cache package as the new version contains fixes for caching error handling. Moreover, we added a new input update-environment. This option allows to specify if the action shall update environment variables (default) or not.

    Update-environment input

    ... (truncated)

    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)
    dependencies github_actions 
    opened by dependabot[bot] 1
  • Bump certifi from 2021.10.8 to 2022.12.7

    Bump certifi from 2021.10.8 to 2022.12.7

    Bumps certifi from 2021.10.8 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) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies python 
    opened by dependabot[bot] 1
  • Improve type hints on main functions

    Improve type hints on main functions

    Currently type information in API is not complete. It makes it hard to use the library with mypy's strict mode and Pyright.

    Also see: https://github.com/darrenburns/ward/issues/261#issuecomment-1301968435

    opened by vrslev 0
  • make async library configurable with support for asyncio/curio/trio

    make async library configurable with support for asyncio/curio/trio

    This merge request adds support to run tests using an async library other than the standard asyncio. This can be configured globally for all tests by setting async-library in the project's pyproject.toml or per test by setting async_library in the test decorator.
    Example: @test('my test that uses curio', async_library="curio")

    opened by logileifs 1
  • [Feature request] Support Curio, trio or other async libraries

    [Feature request] Support Curio, trio or other async libraries

    Would you be willing to add support for Curio and/or Trio? I would submit a PR myself but I see in https://github.com/darrenburns/ward/blob/master/ward/testing.py#L200 that asyncio.run(coro) is hardcoded and I'm not sure how you would go about to make that configurable. If you could check on the user supplied config before calling asyncio.run(coro) you could do something like:

    if self.is_async_test:
        coro = self.fn(**resolved_args)
        if config.asynclib == 'curio':
            import curio
            curio.run(coro)
        elif config.asynclib == 'trio':
            import trio
            trio.run(coro)
        else:
            asyncio.run(coro)
    else:
        self.fn(**resolved_args)
    
    opened by logileifs 1
Releases(release/0.67.0b0)
  • release/0.67.0b0(Nov 3, 2022)

    What's Changed

    • Bump actions/setup-python from 3.1.2 to 4.0.0 by @dependabot in https://github.com/darrenburns/ward/pull/336
    • use asyncio.run by @dantownsend in https://github.com/darrenburns/ward/pull/334
    • [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/darrenburns/ward/pull/337
    • Only re-indent after rewriting asserts in Py <3.11 by @AndydeCleyre in https://github.com/darrenburns/ward/pull/353
    • Add Py 3.11 to test matrix by @AndydeCleyre in https://github.com/darrenburns/ward/pull/354

    New Contributors

    • @dantownsend made their first contribution in https://github.com/darrenburns/ward/pull/334

    Full Changelog: https://github.com/darrenburns/ward/compare/release/0.66.1b0...release/0.67.0b0

    Source code(tar.gz)
    Source code(zip)
  • release/0.66.1b0(Jun 12, 2022)

    What's Changed

    • Plugin config bug fix by @petereon in https://github.com/darrenburns/ward/pull/331
    • Remove some unused 3.6-only code/checks by @darrenburns in https://github.com/darrenburns/ward/pull/326

    New Contributors

    • @petereon made their first contribution in https://github.com/darrenburns/ward/pull/331

    Full Changelog: https://github.com/darrenburns/ward/compare/release/0.66.0b0...release/0.66.1b0

    Source code(tar.gz)
    Source code(zip)
  • release/0.66.0b0(Apr 11, 2022)

    What's Changed

    • Add entry_point to satisfy conda-build by @cheginit in https://github.com/darrenburns/ward/pull/305
    • Allow Tomli v2 by @hukkin in https://github.com/darrenburns/ward/pull/311
    • Bump actions/setup-python from 2 to 3.1.0 by @dependabot in https://github.com/darrenburns/ward/pull/322
    • Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/darrenburns/ward/pull/318
    • Fix 323: Update rich dep version by @taranlu-houzz in https://github.com/darrenburns/ward/pull/324
    • Bump snok/install-poetry from 1.2.1 to 1.3.1 by @dependabot in https://github.com/darrenburns/ward/pull/316
    • Bump actions/setup-python from 3.1.0 to 3.1.2 by @dependabot in https://github.com/darrenburns/ward/pull/325
    • ci: change codecov upload from bash to codecov-action by @AABur in https://github.com/darrenburns/ward/pull/307
    • Add versions to mypy hook's additional dependencies by @mcous in https://github.com/darrenburns/ward/pull/321

    New Contributors

    • @cheginit made their first contribution in https://github.com/darrenburns/ward/pull/305
    • @taranlu-houzz made their first contribution in https://github.com/darrenburns/ward/pull/324
    • @mcous made their first contribution in https://github.com/darrenburns/ward/pull/321

    Full Changelog: https://github.com/darrenburns/ward/compare/release/0.65.0b0...release/0.66.0b0

    Source code(tar.gz)
    Source code(zip)
  • release/0.65.0b0(Oct 8, 2021)

    What's Changed

    • [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/darrenburns/ward/pull/287
    • Bump snok/install-poetry from 1.1.6 to 1.2.1 by @dependabot in https://github.com/darrenburns/ward/pull/299
    • Fixture teardown improvements - output is now captured correctly by @darrenburns in https://github.com/darrenburns/ward/pull/303

    Full Changelog: https://github.com/darrenburns/ward/compare/release/0.64.0b0...release/0.65.0b0

    Source code(tar.gz)
    Source code(zip)
  • release/0.64.0b0(Oct 7, 2021)

    What's Changed

    • Strict keys in config file - invalid config keys will cause error now by @hukkin in https://github.com/darrenburns/ward/pull/292
    • Tear-down exception handling by @mkuyper in https://github.com/darrenburns/ward/pull/293
    • Allow up-to-date dataclasses, cucumber-tag-expressions and pluggy by @hukkin in https://github.com/darrenburns/ward/pull/295
    • Type check tests by @hukkin in https://github.com/darrenburns/ward/pull/294
    • Remove needless enumerate by @hukkin in https://github.com/darrenburns/ward/pull/296
    • Switch from 3.10 beta to 3.10 release by @darrenburns in https://github.com/darrenburns/ward/pull/302

    New Contributors

    • @mkuyper made their first contribution in https://github.com/darrenburns/ward/pull/293

    Full Changelog: https://github.com/darrenburns/ward/compare/release/0.63.0b0...release/0.64.0b0

    Source code(tar.gz)
    Source code(zip)
  • release/0.63.0b0(Jul 9, 2021)

    • Type hints for Ward are now distributed: via https://github.com/darrenburns/ward/pull/283 and several other PRs (thanks to @hukkin)
    • Every type of assertion failure now results in specialised output showing LHS and RHS values. The assertion message is now also displayed in test output (thanks to @JoshKarpel)

    image

    Source code(tar.gz)
    Source code(zip)
  • release/0.62.1b0(Jun 28, 2021)

  • release/0.62.0b0(Jun 25, 2021)

    • https://github.com/darrenburns/ward/pull/279 - Allow subclasses of specified exception class to pass raises assertion (thanks @jeduden)
    • Adds additional type hints to various modules, enables mypy in them (thanks @hukkin)
    Source code(tar.gz)
    Source code(zip)
  • release/0.61.1b0(Jun 11, 2021)

  • release/0.61.0b0(Jun 10, 2021)

    • Switch from toml to tomli to support TOML spec v1.0, and speed up parsing.
    • Small internal change to diffing to support type annotation improvements.

    Thanks to @hukkin for these changes!

    Source code(tar.gz)
    Source code(zip)
  • release/0.60.1b0(Jun 8, 2021)

  • release/0.60.0b0(Jun 5, 2021)

    • Performance improvement to shave ~15% off of test suite run times
    • Adds live output style
    • Add pretty comparison info for in/not in assertion failures

    live output

    live_output

    Assertion info for in/not in

    image

    All of these changes were contributed by @JoshKarpel!

    Source code(tar.gz)
    Source code(zip)
  • release/0.59.0b0(May 30, 2021)

    Ward now outputs diffs using Rich when when an equality check in an assert fails within a test.

    This let us remove the final pieces of colorama and termcolor code from Ward.

    Source code(tar.gz)
    Source code(zip)
  • release/0.58.0b0(May 30, 2021)

    • Fixes #140
    • Fixes #239
    • Fixes issue where pyproject.toml defaults were not being applied
    • Fixes issue with dots-module output where it wouldn't display properly if you were in a directory deeper than a running test module.
    • Changes --exclude to work with paths instead of globs.
    • No longer modify sys.modules during collection phase.
    • Fix module.__package__ being set incorrectly in some cases.
    • Fix issue where exclude defined in pyproject.toml was not interacting with CLI supplied --paths correctly.
    • Changes some semantics around running ward with no --path: it now means "run all tests in my project". If you want to get specific, supply a path. If we can't find the project, then running ward is the same as ward --path ..
    Source code(tar.gz)
    Source code(zip)
  • release/0.57.2b0(May 25, 2021)

  • release/0.57.1b0(May 24, 2021)

  • release/0.57.0b0(May 24, 2021)

    Adds initial support for plugins using Pluggy. In this release, 3 hooks are available: before_session, after_session, and preprocess_tests.

    Source code(tar.gz)
    Source code(zip)
  • release/0.56.0b0(May 20, 2021)

    • Upgrades Ward to use Click v8 thanks to @AABur.
    • Splits some modules into internal/public, adds docs on some public APIs, more selectively exposes functionality to users.
    Source code(tar.gz)
    Source code(zip)
  • release/0.55.0b0(May 15, 2021)

    Adds --progress-style [inline|bar] % progress through test session to output (enabled by default).

    inline

    image

    bar

    image

    Thanks again to @JoshKarpel for this contribution 🎉

    Source code(tar.gz)
    Source code(zip)
  • release/0.54.0b0(Apr 2, 2021)

    Adds when param to @skip and @xfail decorators, allowing you to only apply them when some boolean or Callable predicate holds. e.g.

    @skip("Skipped on Windows", when=platform.system() == "Windows")
    @test("_build_package_name constructs package name '{pkg}' from '{path}'")
    def _(
        pkg=each("", "foo", "foo.bar"),
        path=each("foo.py", "foo/bar.py", "foo/bar/baz.py"),
    ):
        m = ModuleType(name="")
        m.__file__ = path
        assert _build_package_name(m) == pkg
    
    
    @skip("Skipped on Unix", when=platform.system() != "Windows")
    @test("_build_package_name constructs package name '{pkg}' from '{path}'")
    def _(
        pkg=each("", "foo", "foo.bar"),
        path=each("foo.py", "foo\\bar.py", "foo\\bar\\baz.py"),
    ):
        m = ModuleType(name="")
        m.__file__ = path
        assert _build_package_name(m) == pkg
    

    When run on a non-Windows system:

    image Source code(tar.gz)
    Source code(zip)
  • release/0.53.0b0(Apr 2, 2021)

  • release/0.52.1b0(Apr 2, 2021)

  • release/0.52.0b0(Mar 22, 2021)

  • release/0.51.2b0(Mar 21, 2021)

  • release/0.51.1b0(Mar 21, 2021)

  • release/0.51.0b0(Mar 19, 2021)

    ward fixtures allows you to find test fixture dependencies and unused fixtures in your project by printing out

    The ward fixtures --show-dependency-trees command now uses the Tree class from Rich to construct it's output:

    image

    The standard ward fixtures command which simply lists all fixtures that Ward is able to find in a project now also uses Rich for output:

    image

    Contribution by @JoshKarpel Rich: https://github.com/willmcgugan/rich/

    Source code(tar.gz)
    Source code(zip)
  • release/0.50.0b0(Feb 19, 2021)

  • release/0.49.0b0(Feb 19, 2021)

  • release/0.48.0b0(Jul 10, 2020)

    Refactor and improvements to ward fixtures output, which allows you to view information about fixtures in your project and the tests that use them. Thanks @JoshKarpel!

    Screenshot 2020-07-10 at 16 31 27 Source code(tar.gz)
    Source code(zip)
  • release/0.47.0b0(Jun 4, 2020)

    • Exiting during a test or fixture will trigger a failure #165
    • Bump toml to 0.10.0 #164
    • Add coverage reporting with Codecov #167

    Thanks @hoefling and @JoshKarpel!

    Source code(tar.gz)
    Source code(zip)
Owner
Darren Burns
Pythonista @fanduel 🐍
Darren Burns
A small automated test structure using python to test *.cpp codes

Get Started Insert C++ Codes Add Test Code Run Test Samples Check Coverages Insert C++ Codes you can easily add c++ files in /inputs directory there i

Alireza Zahiri 2 Aug 3, 2022
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

Teemu 963 Dec 28, 2022
Ab testing - The using AB test to test of difference of conversion rate

Facebook recently introduced a new type of offer that is an alternative to the current type of bidding called maximum bidding he introduced average bidding.

null 5 Nov 21, 2022
splinter - python test framework for web applications

splinter - python tool for testing web applications splinter is an open source tool for testing web applications using Python. It lets you automate br

Cobra Team 2.6k Dec 27, 2022
splinter - python test framework for web applications

splinter - python tool for testing web applications splinter is an open source tool for testing web applications using Python. It lets you automate br

Cobra Team 2.3k Feb 5, 2021
Parameterized testing with any Python test framework

Parameterized testing with any Python test framework Parameterized testing in Python sucks. parameterized fixes that. For everything. Parameterized te

David Wolever 714 Dec 21, 2022
Based on the selenium automatic test framework of python, the program crawls the score information of the educational administration system of a unive

whpu_spider 该程序基于python的selenium自动化测试框架,对某高校的教务系统的成绩信息实时爬取,在检测到成绩更新之后,会通过电子邮件的方式,将更新的成绩以文本的方式发送给用户,可以使得用户在不必手动登录教务系统网站时,实时获取成绩更新的信息。 该程序仅供学习交流,不可用于恶意攻

null 1 Dec 30, 2021
This is a web test framework based on python+selenium

Basic thoughts for this framework There should have a BasePage.py to be the parent page and all the page object should inherit this class BasePage.py

Cactus 2 Mar 9, 2022
A Proof of concept of a modern python CLI with click, pydantic, rich and anyio

httpcli This project is a proof of concept of a modern python networking cli which can be simple and easy to maintain using some of the best packages

Kevin Tewouda 17 Nov 15, 2022
Front End Test Automation with Pytest Framework

Front End Test Automation Framework with Pytest Installation and running instructions: 1. To install the framework on your local machine: clone the re

Sergey Kolokolov 2 Jun 17, 2022
Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...

Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...

yin kaisheng 1.6k Dec 29, 2022
A modern API testing tool for web applications built with Open API and GraphQL specifications.

Schemathesis Schemathesis is a modern API testing tool for web applications built with Open API and GraphQL specifications. It reads the application s

Schemathesis.io 1.6k Jan 6, 2023
A modern API testing tool for web applications built with Open API and GraphQL specifications.

Schemathesis Schemathesis is a modern API testing tool for web applications built with Open API and GraphQL specifications. It reads the application s

Schemathesis.io 1.6k Dec 30, 2022
A friendly wrapper for modern SQLAlchemy and Alembic

A friendly wrapper for modern SQLAlchemy (v1.4 or later) and Alembic. Documentation: https://jpsca.github.io/sqla-wrapper/ Includes: A SQLAlchemy wrap

Juan-Pablo Scaletti 129 Nov 28, 2022
Test django schema and data migrations, including migrations' order and best practices.

django-test-migrations Features Allows to test django schema and data migrations Allows to test both forward and rollback migrations Allows to test th

wemake.services 382 Dec 27, 2022
Green is a clean, colorful, fast python test runner.

Green -- A clean, colorful, fast python test runner. Features Clean - Low redundancy in output. Result statistics for each test is vertically aligned.

Nathan Stocks 756 Dec 22, 2022
A test fixtures replacement for Python

factory_boy factory_boy is a fixtures replacement based on thoughtbot's factory_bot. As a fixtures replacement tool, it aims to replace static, hard t

FactoryBoy project 3k Jan 5, 2023
A test fixtures replacement for Python

factory_boy factory_boy is a fixtures replacement based on thoughtbot's factory_bot. As a fixtures replacement tool, it aims to replace static, hard t

FactoryBoy project 2.4k Feb 5, 2021
A test fixtures replacement for Python

factory_boy factory_boy is a fixtures replacement based on thoughtbot's factory_bot. As a fixtures replacement tool, it aims to replace static, hard t

FactoryBoy project 2.4k Feb 8, 2021