Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
smheidrich committed Oct 9, 2022
0 parents commit a0c353d
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Comparison of pytest plugins for accessing data files

It is said there are more pytest plugins that aim to provide convenient access
to packaged data files than grains of sand on Earth. Here I compare them all.

## Comparison

<table>
<th>
<td>Name / URL</td>
<td>Supports copying to temp dir</td>
<td>Supports accessing without copying</td>
<td>Paths provided as</td>
<td>Fixture names</td>
<td>Folder names</td>
</th>
<tr>
<td>
<a href="https://pypi.org/project/pytest-datadir/">pytest-datadir</a>
</td>
<td>
True
</td>
<td>
False
</td>
<td>
pathlib.Path
</td>
<td>
`datadir`, `shared_datadir`
</td>
<td>
`data`, `test_TEST_NAME`
</td>
<tr>
<td>
<a href="https://pypi.org/project/pytest-datadir-ng/">pytest-datadir-ng</a>
</td>
<td>
True
</td>
<td>
True
</td>
<td>
py.path
</td>
<td>
`datadir`, `datadir_copy`
</td>
<td>
`data`, `data/test_TEST_NAME`, `test_TEST_NAME`
</td>
<tr>
<td>
<a href="https://pypi.org/project/pytest-datafixtures/">pytest-datafixtures</a>
</td>
<td>
False
</td>
<td>
True
</td>
<td>
pathlib.Path
</td>
<td>
`datafix`, `datafix_dir`, `datafix_read`, `datafix_readbin`
</td>
<td>
`datafixtures`, `**/datafixtures`
</td>
</tr>
</table>
39 changes: 39 additions & 0 deletions README.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Comparison of pytest plugins for accessing data files

It is said there are more pytest plugins that aim to provide convenient access
to packaged data files than grains of sand on Earth. Here I compare them all.

## Comparison

<table>
<th>
<td>Name / URL</td>
<td>Supports copying to temp dir</td>
<td>Supports accessing without copying</td>
<td>Paths provided as</td>
<td>Fixture names</td>
<td>Folder names</td>
</th>
{%- for plugin in plugins %}
<tr>
<td>
<a href="{{ plugin.pypi_url }}">{{ plugin.name }}</a>
</td>
<td>
{{ plugin.supports_copying_to_temp }}
</td>
<td>
{{ plugin.supports_access_without_copying }}
</td>
<td>
{{ plugin.provided_as }}
</td>
<td>
{{ plugin.fixture_names|map('tojson')|join(', ')|replace('"', '`') }}
</td>
<td>
{{ plugin.folder_names|map('tojson')|join(', ')|replace('"', '`') }}
</td>
{%- endfor %}
</tr>
</table>
13 changes: 13 additions & 0 deletions render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
# $ pip list | grep -iE '(jinja|pyyaml)'
# Jinja2 3.0.1
# PyYAML 5.3.1
from jinja2 import Template
from pathlib import Path
import yaml

t = Template(Path("README.template.md").read_text())
with Path("data.yml").open() as f:
d = yaml.load(f, Loader=yaml.SafeLoader)
s = t.render(d)
Path("README.md").write_text(s)

0 comments on commit a0c353d

Please sign in to comment.