Skip to content

Instantly share code, notes, and snippets.

@ykshatroff
Created January 18, 2020 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykshatroff/48675a4802f34c5ffbf2d7ba784f3c43 to your computer and use it in GitHub Desktop.
Save ykshatroff/48675a4802f34c5ffbf2d7ba784f3c43 to your computer and use it in GitHub Desktop.
import os
import tempfile
import pytest
@pytest.fixture()
def file_data():
yield "2020-01-18T13:49:47,text"
@pytest.fixture()
def existing_file():
with tempfile.NamedTemporaryFile("w") as tmp_file:
file_name = tmp_file.name
with open(file_name, 'w') as f:
f.write("Test, data")
yield file_name
os.remove(file_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment