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

using ipytest inside databricks #47

Closed
tade0726 opened this issue Aug 10, 2020 · 2 comments
Closed

using ipytest inside databricks #47

tade0726 opened this issue Aug 10, 2020 · 2 comments

Comments

@tade0726
Copy link

tade0726 commented Aug 10, 2020

I wish to use ipytest in databricks, but I ran into an error like below.

I notice that this is something related to the databricks' mechanism: https://menziess.github.io/howto/test/code-in-databricks-notebooks/

Is it possible we can introduce ipytest in databricks?


My cells:

%%run_pytest[clean] -qq

def test_get_label_dir():
  assert get_label_dir("/test/daisy") == "daisy"

Error:

TypeError: run_cell() missing 1 required positional argument: 'raw_cell'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<command-994187> in <module>
----> 1 get_ipython().run_cell_magic('run_pytest[clean]', '-qq', '\ndef test_get_label_dir():\n  assert get_label_dir("/test/daisy") == "daisy"\n')

/databricks/python/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2350             with self.builtin_trap:
   2351                 args = (magic_arg_s, cell)
-> 2352                 result = fn(*args, **kwargs)
   2353             return result
   2354 

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

/databricks/python/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(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):
@chmp
Copy link
Owner

chmp commented Aug 10, 2020

Hi @tade0726 . Thanks for reporting this issue. I am not using databricks myself, so it's really hard for me to debug. My feeling is that the magic mechanism somehow works differently in Databricks. Could you try running it manually? Maybe that would be an option. You code should be more or less the same as

ipytest.clean_tests()

# <your code>
def test_get_label_dir():
  assert get_label_dir("/test/daisy") == "daisy"

ipytest.run(["-qq"])

Meanwhile I'll also try to ping Databricks on twitter maybe they're willing to support here.

@chmp
Copy link
Owner

chmp commented Sep 22, 2020

Since there is no feedback from op or databricks, I'll close this as not supported.

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