Skip to content

Instantly share code, notes, and snippets.

View ashutosh1919's full-sized avatar
:octocat:
Building for the Betterment of World

Ashutosh Hathidara ashutosh1919

:octocat:
Building for the Betterment of World
View GitHub Profile
@bryder
bryder / py.test_tmpdir_usage
Last active April 27, 2021 13:23
How to use py.test tmpdir
# https://pytest.org/latest/tmpdir.html
# http://py.readthedocs.org/en/latest/path.html
# Using in conftest.py
@pytest.fixture(autouse=True)
def a_tmp_filename(tmpdir):
p = tmpdir.join("filename")
p.write("some stuff\n")
return str(p) # str(p) returns the full pathname you can use with normal modules