`import pytest; pytest.main()` not working

Following the tutorial here: https://docs.replit.com/tutorials/python/test-driven-development

But using my own codebase.

In main.py, using

import pytest
pytest.main()

runs the tests fine.

Then the tutorial says you can run

import pytest; pytest.main()

In the console. I commented the test runner lines out in main.py, hit run button to refresh, and typed the command in the console.

Instead of running the tests, it seems to give me a > prompt.

(screencap :point_down:)

image

But the tests do not run. Tried the same in shell, same result.

How does one run the tests from the console or the shell?

Thanks.

I was able to make the tests work, but only in the python3 REPL.

The instructions say:

you can also invoke pytest directly from the output console on the right by typing import pytest; pytest.main()

But in my case, it only worked after entering the python3 REPL first.

But for the tests to reflect changes in the code, I need to exit and re-enter the REPL, which is clunky.
Is there a way to get the tests to run without launching the REPL first?

Thanks.