Skip to content

using ipytest inside databricks #47

@tedzhao226

Description

@tedzhao226

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions