chmp / ipytest

Pytest in IPython notebooks.
MIT License
314 stars 17 forks source link

UsageError: Line magic function `%%run_pytest` not found. #44

Closed highpost closed 4 years ago

highpost commented 4 years ago

I installed ipytest with pip in my virtualenv and then created a Jupyter notebook with Visual Studio Code:

import ipytest
ipytest.autoconfig()

%%run_pytest[clean] -qq 

def test_example():
    assert [1, 2, 3] == [1, 2, 3]

But I'm getting an error that the magic function isn't being found:

UsageError: Line magic function `%%run_pytest` not found.

Notes:

chmp commented 4 years ago

Hi @highpost . Thanks for the report. Just checking: you are using two separate cells for the ipytest setup and then the test itself, right? It should look like:

grafik

I just re-read the Readme and have to admit, that this part is not quite clearly formulated. I will update it.

highpost commented 4 years ago

Yes, that works. My mistake was combining them into a single cell.