ipytest icon indicating copy to clipboard operation
ipytest copied to clipboard

Impossible to found tests: no tests ran

Open GreGGus opened this issue 11 months ago • 3 comments

Hey.

I'm using Jupyter Notebook on VSCode, in order to test some transformations on Databricks (using db-connect).

No idea why, but after a lot of time, i'm not able to run any tests.

I did run everything, but each time i got:

no tests ran in 0.00s.

Even with Example notebooks.

What am i doing wrong ?

Image

Thanks

GreGGus avatar Feb 17 '25 06:02 GreGGus

If I remember correctly, #50, #47, databricks is using their own setup for notebooks. I think, ipytest never quite worked with databricks.

If you run import __main__; print(sorted(vars(__main__))), do you see the test functions?

chmp avatar Feb 17 '25 07:02 chmp

Forget about Databricks (or not apparently), I'm not using their notebooks. I'm just trying to setup your example, and then I'll connect it to Databricks (and it should work tbh).

I'll share with you if I'm able to make it work. (think a lot of user are interested about that) (I'm using Databricks-Connect to let Spark read Data from Databricks). Works perfectly with pytest and normal python file. Works perfectly with my .ipynb (I'm able to connect to DBX), but tests are not working.

Let's get back to your example:

Image

I'm using 100% .ipynb file, download directly from your repo.

No idea what I missed here.

Thanks you so much for you help.

VSCode on MAC

This is the results of your import __main__; print(sorted(vars(__main__))),

['@py_builtins', '@pytest_ar', 'Any', 'In', 'List', 'Magics', 'Out', 'Union', '_', '__', '___', '__builtin__', '__builtins__', '__doc__', '__loader__', '__main__', '__name__', '__package__', '__spec__', '__vsc_ipynb_file__', '_dh', '_exit_code', '_i', '_i1', '_i2', '_i3', '_i4', '_ih', '_ii', '_iii', '_oh', 'builtinSum', 'cfg', 'contextmanager', 'convert_databricks_notebook_to_ipynb', 'databricks_notebook_exec_env', 'dbutils', 'display', 'displayHTML', 'exit', 'functools', 'getArgument', 'get_ipython', 'ipytest', 'is_databricks_notebook', 'json', 'line_magic', 'logError', 'logErrorAndContinue', 'magics_class', 'my_func', 'needs_local_scope', 'open', 'os', 'quit', 'shlex', 'show_progress', 'spark', 'sql', 'strip_hash_magic', 'sys', 'tempfile', 'test_my_func', 'time', 'udf', 'warnings']

GreGGus avatar Feb 17 '25 07:02 GreGGus

Hm. Strange. TBH. I have no idea what's happening. I just verified that ipytest works in VSCode without issue. Can you check what kernel you are running? (import sys; print(sys.argv) What ipytest version have you installed?

chmp avatar Feb 19 '25 21:02 chmp