Skip to content

Commit

Permalink
rename RequestsData
Browse files Browse the repository at this point in the history
  • Loading branch information
grizz committed Jan 1, 2018
1 parent 315d026 commit de1831b
Show file tree
Hide file tree
Showing 4 changed files with 494 additions and 5 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@

easily load test data from files

### Introduction

This was created to save the tediousness of working with sets of data for
testing inside the test files.

### Installing

```sh
pip install pytest-filedata
```

### Using

Add this to your `conftest.py` file:

```python
pytest.setup_filedata(os.path.dirname(__file__))


def pytest_generate_tests(metafunc):
for fixture in metafunc.fixturenames:
if fixture.startswith('data_'):
data = pytest.get_filedata(fixture)
metafunc.parametrize(fixture, data.values(), ids=data.keys())
```


### License

Copyright 2016 20C, LLC
Expand Down
4 changes: 2 additions & 2 deletions pytest_filedata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_filedata(name):
return data


class RequestData(object):
class RequestsData(object):
"""
class to use test data from requests
"""
Expand Down Expand Up @@ -145,6 +145,6 @@ def pytest_namespace():
"""Register pytest plugin."""
return dict(
get_filedata=get_filedata,
RequestData=RequestData,
RequestsData=RequestsData,
setup_filedata=setup_filedata,
)
Loading

0 comments on commit de1831b

Please sign in to comment.