Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AsiehH opened this issue Dec 15, 2020 · 3 comments
Closed

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

AsiehH opened this issue Dec 15, 2020 · 3 comments

Comments

@AsiehH
Copy link

AsiehH commented Dec 15, 2020

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
Copy link
Owner

chmp commented Dec 15, 2020

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
Copy link
Owner

chmp commented Jul 2, 2021

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
Copy link
Owner

chmp commented Jul 2, 2021

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.

@chmp chmp closed this as completed Jul 2, 2021
@chmp chmp reopened this Jul 2, 2021
@chmp chmp closed this as completed Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants