ward

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

MIT License

Downloads
3.1K
Stars
1.2K
Committers
31

Bot releases are hidden (Show)

ward - 0.54.0b0 - Conditional skip and xfail

Published by darrenburns over 3 years ago

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:

ward - 0.53.0b0 - Support relative imports

Published by darrenburns over 3 years ago

Relative imports are now supported in test modules and dependencies.

ward - 0.52.1b0 - test modules added to sys.modules

Published by darrenburns over 3 years ago

Test modules will now be added to sys.modules.

ward - 0.52.0b0 - Support for `pdb.set_trace()` and `breakpoint()`

Published by darrenburns over 3 years ago

Ward will automatically stop capturing output when a debugging session is started via pdb.set_trace() or breakpoint().

ward - 0.51.2b0 - Fix minor display issue

Published by darrenburns over 3 years ago

Fixes a minor display issue where an extra line of space was being displayed above the code snippet output when an assertion failed.

ward - 0.51.1b0 - Lambdas can now be used inside `each`

Published by darrenburns over 3 years ago

Bugfix means that using lambdas inside each works as you would expect.

Thanks to @JoshKarpel for contributing this fix!

ward - 0.51.0b0 - `ward fixtures` migrated to use Rich library

Published by darrenburns over 3 years ago

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:

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:

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

ward - 0.50.0b0 - Command line tab completion

Published by darrenburns over 3 years ago

Running ward completions will install a tab completion script for your terminal.

image

ward - 0.49.0b0 - Using Rich for test output

Published by darrenburns over 3 years ago

Migrates all output associated with ward test to the Rich library for terminal output.

image

ward - 0.48.0b0

Published by darrenburns over 4 years ago

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!

ward - 0.47.0b0

Published by darrenburns over 4 years ago

  • 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!

ward - 0.46.0b0

Published by darrenburns over 4 years ago

If tests are incorrectly parameterised (e.g. mismatch in each argument counts), they will now fail without running and won't be expanded into parameterised instances.

ward - 0.45.0b0 - adds `--show-diff-symbols` option

Published by darrenburns over 4 years ago

The --show-diff-symbols option has been added, which allows you to present diffs using symbols rather than background colours. This improves accessibility and support for CI systems that don't support ANSI terminal output.

ward - 0.44.1b0

Published by darrenburns over 4 years ago

Workaround for a bug in virtualenv which means site.getsitepackages() is not available inside virtual envs. https://github.com/pypa/virtualenv/issues/228

ward - 0.44.0b0

Published by darrenburns over 4 years ago

Ward will no longer look in site-packages when discovering tests, preventing interference from third party packages that don't exclude tests from their distributions.

Thanks to @anlutro for this!

ward - 0.43.0b0 - `fixtures` subcommand

Published by darrenburns over 4 years ago

Adds the fixtures subcommand. By default this command lists out all fixtures present in the project. For example, running ward fixtures gives us the following output:

We can also run ward fixtures --show-dependency-tree to see the relationship between fixtures:

Thanks to @JoshKarpel for this contribution!

ward - 0.42.0b0 - Tagging and querying with tag expressions

Published by darrenburns over 4 years ago

You can now tag tests using the tags keyword argument of the @test decorator:

@test("simple addition", tags=["unit", "regression"])
def _():
    assert 1 + 2 == 3

To query these tags, you can use a tag expression.

ward --tags EXPR

More examples of tag expressions:

Tag Expression Meaning
slow tests tagged with slow
unit and integration tests tagged with both unit and integration
big and not slow tests tagged with big that aren't also tagged with slow
android or ios tests tagged with either android or ios

You can use parentheses in tag expressions to change precedence rules to suit your needs.

Thanks @thebigmunch for adding this feature.

ward - 0.41.0b0

Published by darrenburns over 4 years ago

  • Migrates Ward to use Poetry instead of Flit/pip.
  • Removes chart output after tests run. The chart was causing me maintenance issues and I don't believe it's worth the effort for something that doesn't provide a great deal of value when it comes down to it.
  • Updates Makefile and contribution guide
  • Updates GitHub Actions to make use of Poetry for dependency management and releasing to PyPI.
ward - 0.40.1b0

Published by darrenburns over 4 years ago

A release earlier today (11 March 2020) introduced an issue where Ward would raise an exception when a non-comparison based assertion failed. This release fixes that issue.

ward - 0.40.0b0

Published by darrenburns over 4 years ago

User is informed if Ward finds and uses their pyproject.toml. Thanks to @mandarvaze.

Package Rankings
Top 29.96% on Conda-forge.org
Top 3.27% on Pypi.org
Badges
Extracted from project README
Codecov Documentation Status PyPI version