chmp/ipytest

run_cell() missing 1 required positional argument: 'raw_cell'

AsiehH opened this issue · 3 comments

Hi,
I installed ipytest, and ran the following in one cell

import ipytest
ipytest.autoconfig()

which was successful. But the first of the following lines gave me an error:

%%run_pytest[clean] -qq

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

I also tried %%run_pytest[clean]

The error I get is this:
run_cell() missing 1 required positional argument: 'raw_cell'

with the following detail:


TypeError Traceback (most recent call last)
in
----> 1 get_ipython().run_cell_magic('run_pytest[clean]', '-qq', '\ndef test_example():\n assert [1, 2, 3] == [1, 2, 3]\n')

/databricks/python/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2360 with self.builtin_trap:
2361 args = (magic_arg_s, cell)
-> 2362 result = fn(*args, **kwargs)
2363 return result
2364

</databricks/python/lib/python3.7/site-packages/decorator.py:decorator-gen-123> in run_pytest_clean(self, line, cell)

/databricks/python/lib/python3.7/site-packages/IPython/core/magic.py in (f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

/databricks/python/lib/python3.7/site-packages/ipytest/_pytest_support.py in run_pytest_clean(self, line, cell)
258
259 clean_tests(items=main.dict)
--> 260 return self.run_pytest(line, cell)
261
262 @cell_magic

</databricks/python/lib/python3.7/site-packages/decorator.py:decorator-gen-124> in run_pytest(self, line, cell)

/databricks/python/lib/python3.7/site-packages/IPython/core/magic.py in (f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

/databricks/python/lib/python3.7/site-packages/ipytest/_pytest_support.py in run_pytest(self, line, cell)
268
269 else:
--> 270 self.shell.run_cell(cell)
271
272 import ipytest

TypeError: run_cell() missing 1 required positional argument: 'raw_cell'

chmp commented

Thanks for the report. I'm afraid this is a known issue.

It seems databricks modifies the base IPython shell. Unfortunately, I don't use databricks myself. So I can't debug this issue, but I'm happy to accept PRs on this topic.

chmp commented

Not sure this is still relevant: but simply using ipytest.run() and ipytest.clean_tests() should run. Only the magics are currently not supported.

chmp commented

Added additional debugging info to the magic function. As there is no way for me to fix this issue and there is a work around available, I will close this ticket once the changes of #59 are released.