-
Notifications
You must be signed in to change notification settings - Fork 8
Testing python packages
I like to develop and test everything independently, so I try to design so that the different pieces that are part of the Wikichron architecture are isolated enough to do so.
In python, every .py
source file is considered a module, a folder which contains a set of modules is called a package. Importing modules and making them independently executables has become a pain since python 3 (see this). So here there is some guidance in order to test the packages that belongs to Wikichron main source code.
If you want to test the packages located in lib/, you have to use the -m switch and to be outside of that folder.
Suppose, for instance, that you want to test the module lib.metric.metrics_generator
. You would have to be in the root of wikichron source code and run:
python -m lib.metrics.metrics_generator
If you want to test any modules which corresponds to the UI elements of Wikichron, namely: side_bar, main, app or tabs_bar, you can directly run them using python3 <name of python source file>
and with the browser go to http://127.0.0.1:port
where port will be given to you in the terminal output.
For instance, if you want to test just the side_bar component, run python3 side_bar.py
and go to http://127.0.0.1:8052/
This is better addressed. Just go to the library's github and follow the instructions given there.
If you want, for instance, test the grasia_dash_components library, download its source code and run npm test
within the source root directorty.