[Developer] Setup for developing features for bench

I posted this in the frappe/erpnext gitter channel today but thought I’ll give it a try here, since fewer people seem to use gitter.

I’m trying to write a test in succession of my pull request: Add '--overwrite' flag to 'bench init' #396 by DRogueRonin · Pull Request #398 · frappe/bench · GitHub. But I’m struggling with having a correct setup for this. I’m using a vagrant box right now and just running the install script in my vm with minor tweaks to the install script just for that. But before comitting I have to remove that changes and stuff.

Could anyone of the frappe team (@revant_one), share their setup for developing and testing bench features locally?

I have a ubuntu 16.10 x64 laptop.

I add my remote to the bench/frappe/erpnext repo dir.

I checkout to forked branches and test out things.

Ok, I do that too, just in a vm. :smile:

I was specifically asking about bench and the easy-install script, because I’m having a hard time to build an environment where I can test the complete process.
Or do you just run the unittests to confirm that your changes are working? I can’t seem to get them to work on my machine locally.

When running

python -m unittest bench.tests.test_init

I get

AttributeError: 'module' object has no attribute 'test_init'

and when just running

python -m unittest bench.tests

it’s running 0 tests and exists.

Could you hint me a link or something that could help?

python -m unittest bench.tests.test_init
python3.5 -m unittest bench.tests.test_init

Both these commands start the tests on my laptop and create a test-bench directory in working directory.

Working as expected.

I depend on travis-ci more and check things there through its web ui.

Ok I got it working now. I tried running it on my MacBook and on my ubuntu pc, but got the same error messages.
I then created a clean ubuntu vm and installed pip wit the get-pip.py script but installing anything further always failed.

So I installed pip with

sudo apt-get install python-pip python3-pip

and the bench requirements with

pip install -r requirements.txt
pip3 install -r requirements.txt

and now the unittest commands are working.