question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide basic builtin fixtures

See original GitHub issue

Currently ward contains no built-in fixtures. There’s a few ones that would be nice, if were provided, like pytest tmp_path:

tmp_path
    Return a temporary directory path object which is unique to each test
    function invocation, created as a sub directory of the base temporary
    directory.

    By default, a new base temporary directory is created each test session,
    and old bases are removed after 3 sessions, to aid in debugging. If
    ``--basetemp`` is used then it is cleared each session. See :ref:`base
    temporary directory`.

    The returned object is a :class:`pathlib.Path` object.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
darrenburnscommented, Jun 10, 2021

Mentioned elsewhere that an equivalent of capsys would also be useful.

0reactions
AndydeCleyrecommented, Nov 22, 2022

I just want to note that for the case of tmp_path, I happily include plumbum in my testing dependencies, giving me access to these fine context managers:

from plumbum import local

with local.tempdir() as tmp:
    with local.cwd(tmp):

I always prefer their path objects anyway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest fixtures: explicit, modular, scalable
Software test fixtures initialize test functions. They provide a fixed baseline so that tests execute reliably and produce consistent, repeatable, results.
Read more >
An overview of built-in fixtures | pytest Quick Start Guide
Let's take a look at some built-in pytest fixtures. ... The tmpdir fixture provides an empty directory that is removed automatically at the...
Read more >
Pytest API and builtin fixtures
For information on the pytest.mark mechanism, see Marking test functions with attributes. For information about fixtures, see pytest fixtures: explicit, modular ...
Read more >
End-To-End Tutorial For Pytest Fixtures With Examples
For a simple test, this small overhead might not make such a huge difference in the execution. However, if the Selenium test automation ......
Read more >
Python Friday #47: (Built-in) Fixtures in Pytest
Fixtures are a powerful feature in pytest. You can write your own fixtures as a replacement for setup and teardown methods or use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found