FreedomBox/Debugging: Difference between revisions
From Wiki
(Run only one test using pytest) |
(Update pytest syntax to run only one test) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
===Development and Debugging=== | ===Development and Debugging=== | ||
==== | ====Starting from scratch==== | ||
<pre> | <pre> | ||
vagrant destroy -f; | vagrant destroy -f; | ||
Line 7: | Line 7: | ||
vagrant up; | vagrant up; | ||
vagrant provision | vagrant provision | ||
</pre> | |||
====Resetting the VM==== | |||
<pre> | |||
vagrant destroy -f && vagrant up && vagrant reload && vagrant ssh | |||
</pre> | </pre> | ||
Line 31: | Line 36: | ||
====Run only one test==== | ====Run only one test==== | ||
<pre> | <pre> | ||
./ | # Unit tests | ||
py.test -k test_url_not_an_application plinth/tests/test_middleware.py | |||
# Functional tests | |||
py.test --include-functional -k test_backup_restore plinth/modules/kiwix/ | |||
</pre> | </pre> | ||
Line 70: | Line 79: | ||
<pre> | <pre> | ||
buildbot checkconfig && (buildbot stop; buildbot upgrade-master; buildbot start) | buildbot checkconfig && (buildbot stop; buildbot upgrade-master; buildbot start) | ||
</pre> | |||
====Continuously run unit tests during development==== | |||
* Install the package '''entr''' from Debian. | |||
* Run this command in a module directory, such as ''plinth/modules/mediawiki/'' | |||
<pre> | |||
find . -name '*.py' | entr -s 'py.test-3' | |||
</pre> | |||
====Clean all __pycache__ files==== | |||
<pre> | |||
find . | grep -E (__pycache__|\.pyc|\.pyo$) | xargs rm -rf | |||
</pre> | |||
====Reload browser tab automatically==== | |||
<pre> | |||
fd -e html -e css | entr reload-browser Firefox | |||
</pre> | |||
====Remove deleted loopback devices==== | |||
<pre> | |||
dmsetup remove_all | |||
</pre> | </pre> |
Latest revision as of 09:05, 17 September 2023
Development and Debugging
Starting from scratch
vagrant destroy -f; vagrant box remove freedombox/plinth-dev; vagrant up; vagrant provision
Resetting the VM
vagrant destroy -f && vagrant up && vagrant reload && vagrant ssh
To uninstall diaspora
apt remove --purge diaspora diaspora-common && echo "delete from plinth_module where name='diaspora';" | sqlite3 /var/lib/plinth/plinth.sqlite3
To run in debug (autoreload) mode (doesn't work for files under actions/ folder)
sudo -u plinth /vagrant/run --develop
To open a file in emacs as root@vagrant
mkdir /root/.ssh cp /home/vagrant/.ssh/authorized_keys /root/.ssh
Run only one test
# Unit tests py.test -k test_url_not_an_application plinth/tests/test_middleware.py # Functional tests py.test --include-functional -k test_backup_restore plinth/modules/kiwix/
Using pytest
py.test-3 -q -s plinth/modules/backups/tests/test_ssh_remotes.py
Vagrant box download for plinth-dev
wget -O ~/FreedomBox/plinth-dev.box https://app.vagrantup.com/freedombox/boxes/plinth-dev/versions/<version>/providers/virtualbox.box
To use the local box instead of downloading from repo
vagrant box add --name freedombox/plinth-dev <box name>
Turning off mac address randomization in Network Manager
Add this line to all files in /etc/NetworkManager/system-connections under wifi or ethernet or whatever.
mac-address-randomization=0
Login into ttrss Postgresql database
sudo -n -u postgres /bin/bash postgres psql -d ttrss -U ttrss -h localhost
Restart BuildBot server after making changes
This command should be run from the directory that contains the file master.cfg
buildbot checkconfig && (buildbot stop; buildbot upgrade-master; buildbot start)
Continuously run unit tests during development
- Install the package entr from Debian.
- Run this command in a module directory, such as plinth/modules/mediawiki/
find . -name '*.py' | entr -s 'py.test-3'
Clean all __pycache__ files
find . | grep -E (__pycache__|\.pyc|\.pyo$) | xargs rm -rf
Reload browser tab automatically
fd -e html -e css | entr reload-browser Firefox
Remove deleted loopback devices
dmsetup remove_all