Left: | ||
Right: |
OLD | NEW |
---|---|
1 # Sitescripts | 1 # Sitescripts |
2 | 2 |
3 ## Introduction | 3 ## Introduction |
4 | 4 |
5 The sitescripts repository contains many of the server side Python scripts that | 5 The sitescripts repository contains many of the server side Python scripts that |
6 we use. There are both web handlers, which can be used via the multiplexer, and | 6 we use. There are both web handlers, which can be used via the multiplexer, and |
7 scripts that perform other tasks. | 7 scripts that perform other tasks. |
8 | 8 |
9 The scripts are often unrelated and as such will not all be documented here. For | 9 The scripts are often unrelated and as such will not all be documented here. For |
10 more information about the individual scripts you will need to look at their | 10 more information about the individual scripts you will need to look at their |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 So, to test any of the URL handlers in development do the following: | 74 So, to test any of the URL handlers in development do the following: |
75 | 75 |
76 1. Create a sitescripts configuration file that lists the web modules that you | 76 1. Create a sitescripts configuration file that lists the web modules that you |
77 are testing under the `multiplexer` section. (Depending on the modules you are | 77 are testing under the `multiplexer` section. (Depending on the modules you are |
78 testing you may need to add additional configuration as well.) | 78 testing you may need to add additional configuration as well.) |
79 2. Save the configuration file somewhere where it will be found, for example | 79 2. Save the configuration file somewhere where it will be found, for example |
80 `~/.sitescripts`. | 80 `~/.sitescripts`. |
81 3. Type `python multiplexer.py`, it will start a web server at | 81 3. Type `python multiplexer.py`, it will start a web server at |
82 http://localhost:5000/ . This web server will use any URL handlers that have | 82 http://localhost:5000/ . This web server will use any URL handlers that have |
83 been defined in the modules you are testing to respond to requests. | 83 been defined in the modules you are testing to respond to requests. |
84 | |
85 | |
86 ## Testing | |
87 | |
88 There are tests for some parts of the functionality of sitescripts. They are | |
89 located in `test` directories and can be run via | |
90 [Tox](https://tox.readthedocs.org/). There are two parts of the test suite: | |
91 the tests that only depend on the packages that can be automatically installed | |
92 by tox and the tests that have other dependencies (a database). The first part | |
93 is run by tox by default: | |
94 | |
95 $ tox | |
96 | |
97 The tests dependent on the database are covering the packages `filterhits` and | |
Sebastian Noack
2016/05/24 07:58:36
Nice idea to use Vagrant for tests with non-python
| |
98 `notifications`. They can be run in a standard prepared environment using | |
99 [vagrant](https://www.vagrantup.com://www.vagrantup.com/): | |
100 | |
101 $ vagrant up | |
102 Bringing machine 'default' up with 'virtualbox' provider... | |
103 ==> default: Importing base box 'debian/contrib-jessie64'... | |
104 ... | |
105 $ vagrant ssh | |
106 ... | |
107 vagrant@debiancontrib-jessie:~$ cd /vagrant | |
108 vagrant@debiancontrib-jessie:/vagrant$ tox -e filtehits,notifications | |
mathias
2016/05/23 22:25:32
Do you really want a binary image from an un-trust
| |
109 | |
110 It's also possible to run the other tests inside of vagrant environment by not | |
111 giving any arguments to `tox`. | |
112 | |
113 Please note that since the subpackages of sitescripts are not installed via | |
114 `setup.py` but are instead imported directly from the working directory, the | |
115 `.pyc` files that are created next to the `.py` files might be obsolete and or | |
116 not matching the environment. This might cause the tests to fail and Tox/Pytest | |
117 normally hints at the source of the problem in these cases. The problem can be | |
118 fixed by deleting all `.pyc` files: | |
119 | |
120 $ find . -name '*.pyc' | xargs rm | |
mathias
2016/05/23 22:25:32
After addressing my comment above, you could trans
| |
OLD | NEW |