| 1 |
So, you want to see what's broken? Eeeexcellent. Welcome to the testing branch. |
|---|
| 2 |
|
|---|
| 3 |
First thing to do is run the tests. |
|---|
| 4 |
If you have genshi and twill installed on your system, you should be able to run the tests like this: |
|---|
| 5 |
{{{ |
|---|
| 6 |
PYTHONPATH=. ./trac/test.py |
|---|
| 7 |
}}} |
|---|
| 8 |
|
|---|
| 9 |
If you want to test against specific versions of genshi, twill, pygments, etc., you can set those up like this: |
|---|
| 10 |
{{{ |
|---|
| 11 |
myworktree/trac |
|---|
| 12 |
/pygments-0.8 |
|---|
| 13 |
/twill-0.9 |
|---|
| 14 |
/genshi-0.4.4 |
|---|
| 15 |
}}} |
|---|
| 16 |
|
|---|
| 17 |
Run `python setup egg_info` in those subdirectories as needed. |
|---|
| 18 |
Then you can run: |
|---|
| 19 |
{{{ |
|---|
| 20 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 ./trac/test.py |
|---|
| 21 |
}}} |
|---|
| 22 |
|
|---|
| 23 |
If you want to run just the functional tests, you can do that by running |
|---|
| 24 |
{{{ |
|---|
| 25 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 ./trac/tests/functional/testcases.py |
|---|
| 26 |
}}} |
|---|
| 27 |
|
|---|
| 28 |
And to run everything except the functional tests, |
|---|
| 29 |
{{{ |
|---|
| 30 |
PYTHONPATH=. ./trac/test.py --skip-functional-tests |
|---|
| 31 |
}}} |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
NOTE: Unlike most unittests, the functional tests share a test fixture across tests. This means that you can't(*) run just one of the tests by itself. |
|---|
| 35 |
You can now run a sub-set of the functional tests: |
|---|
| 36 |
{{{ |
|---|
| 37 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 ./trac/tests/functional/__init__.py |
|---|
| 38 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 ./trac/ticket/tests/functional.py |
|---|
| 39 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 ./trac/versioncontrol/tests/functional.py |
|---|
| 40 |
}}} |
|---|
| 41 |
Note that that there is a set of functional tests that are run regardless of what subset you choose. |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
(*) Unless you modify the code to comment out the other functional tests. The test fixture is setup and torn down by `FunctionalTestSuite`, and it runs the tests added to it with `_tester` and `_testenv` set in the testcase objects. |
|---|
| 45 |
|
|---|
| 46 |
The functional tests require subversion, and use a random port 8000-8999 for the test web server |
|---|
| 47 |
|
|---|
| 48 |
There is some logging done: |
|---|
| 49 |
- testing.log |
|---|
| 50 |
output from trac environment creation, tracd, and some svn commands |
|---|
| 51 |
- functional-testing.log |
|---|
| 52 |
output from twill |
|---|
| 53 |
|
|---|
| 54 |
The test fixture is left behind in 'testenv' so you can inspect it when debugging a problem. |
|---|
| 55 |
{{{ |
|---|
| 56 |
testenv/htpasswd -- the password/authentication for the test fixture. password = username |
|---|
| 57 |
/repo -- the Subversion repository |
|---|
| 58 |
/trac -- the Trac environment |
|---|
| 59 |
}}} |
|---|
| 60 |
|
|---|
| 61 |
The command to serve the test environment is: |
|---|
| 62 |
{{{ |
|---|
| 63 |
PYTHONPATH=.:../twill-0.9:../genshi-0.4.4:../pygments-0.8 \ |
|---|
| 64 |
./trac/web/standalone.py --basic-auth=trac,testenv/htpasswd, -s \ |
|---|
| 65 |
--port=8888 testenv/trac |
|---|
| 66 |
}}} |
|---|
| 67 |
|
|---|
| 68 |
-------------------------------------------------------------------------------- |
|---|
| 69 |
== TROUBLESHOOTING: == |
|---|
| 70 |
|
|---|
| 71 |
1. trac-admin is failing on initenv with this exception: |
|---|
| 72 |
{{{ |
|---|
| 73 |
raise Exception('Failed with exitcode %s running trac-admin with %r' % (retval, args)) |
|---|
| 74 |
Exception: Failed with exitcode 1 running trac-admin with ('initenv', 'testenv', 'sqlite:db/trac.db', 'svn', '..../testenv/repo') |
|---|
| 75 |
}}} |
|---|
| 76 |
This can be caused by not having run `python setup.py egg_info` in the genshi tree. |
|---|
| 77 |
|
|---|
| 78 |
2. Windows needs an implementation of crypt or fcrypt. Carey Evans' pure |
|---|
| 79 |
python version works, but prints warnings on Python 2.3 (they can be |
|---|
| 80 |
ignored). See http://carey.geek.nz/code/python-fcrypt/ |
|---|
| 81 |
|
|---|
| 82 |
3. Python versions compatibility notes |
|---|
| 83 |
* If using Python >=2.4.0, <2.4.4, you need to backport `unittest` from |
|---|
| 84 |
2.4.4. If you do not do this, you will get an `AttributeError` regarding |
|---|
| 85 |
`_fixture` being unset on every test. |
|---|
| 86 |
* If using Python >=2.3.0, <2.3.5, you need to backport a few modules for |
|---|
| 87 |
`setuptools` to work properly (`httplib2`, `cookielib`, `_*CookieJar`) and |
|---|
| 88 |
remove the tuple imports to replace with explicit line continuations. |
|---|
| 89 |
* If using Python >=2.3.0, <2.4.0, you need `subprocess`, `unittest`, and |
|---|
| 90 |
`traceback` from 2.4.4. On Windows you also need to modify `subprocess.py` |
|---|
| 91 |
to use `pywin32` instead of `_subprocess`. Twill includes a `subprocess` |
|---|
| 92 |
module that will not work in this situation because it is not modified. |
|---|
| 93 |
|
|---|