UnitTest for a new DocType Field

Hey guys, stack here with a UnitTest.

This how I am entering my python shell for debugging:

    cd /frappe-bench
    source venv/bin/activate
    cd /apps/erpnext/erpnext/buying/doctype/supplier/
    ipython

Now the following:

  from frappe.test_runner import make_test_records
  test_records = frappe.get_test_records('Supplier')

this fails with error:

    305         except AttributeError:
--> 306             raise RuntimeError('no object bound to %s' % self.__name__)
    307
    308     @property

RuntimeError: no object bound to conf

which is totally correct as I am not inside app content manager.

Searching around bench --help where is a command bench shell but it seems not to work.

So, what is the way of opening a python shell inside apps.content.manager ? (I have priori experience with Flask , so if it helps, I search a way to have app.app_context() ).

I also see that frappe.conf is <LocalProxy unbound> , so probably I need to bound ?

Ty all, kickapoo

There’s a bench command to specifially run tests. bench run-tests. Have a look here for all the options : Bench Commands Cheatsheet

If you want to access frappe functions from IPython, use bench --site [site-name] console and do just import the function you want / entire frappe.

Ty @vjFaLk for your answer bench --site [site-name] console is that I was looking