Jc2k / pytest-markdown

Run tests in your markdown
11 stars 2 forks source link

Add ability to evaluate entire block as a test #6

Open ssbarnea opened 3 years ago

ssbarnea commented 3 years ago

Instead of requiring use of pytest test definition, the python snippets should be evaluated as a standalone test that just needs to be executed.

Example:

print(123)

If that is found, a test should be generated for it, one that just runts the code inside the snippet.

Reasoning: README.md examples do aim to be as short as possible in order to demonstrate functionality. By avoiding the boilerplate test methods we keep them easy to read.

Jc2k commented 3 years ago

I thought this was my other pytest plugin and was confused about how this could possibly work (my other plugin makes heavy use of fixtures, so the def test_foo(fixturename) is important).

I'd take a PR to do this, if it preserved the existing behaviour as well (it should be a non breaking change for pytest-docker-tools).

Jc2k commented 3 years ago

(I guess that's an important bit of context, this plugin really only exists for pytest-docker-tools).