Le 11 nov. 2012 à 06:53, Shai Berger <
sh...@platonix.com> a écrit :
> On Sunday 11 November 2012, Tim Graham wrote:
>>
>> I think the part that has the most potential to confuse new contributors is
>> the introduction of PYTHONPATH. Claude suggested we could simply instruct
>> users to run the tests like so:
>>
>> PYTHONPATH=/path/to/django ./run_tests.py --settings=test_sqlite
>>
>> I'm not particularly in love with that, but it would eliminate the need to
>> try to explain things
I've always been running the tests with:
$ cd tests
$ PYTHONPATH=.. pythonX.Y runtests.py --settings=test_<xxx>
It's straightforward and easy to understand: "Python will look for django in the parent directory".
If you're just running Django's test suite on a reasonably configured system, you're starting with an empty PYTHONPATH; you don't really need PYTHONPATH=..:$PYTHONPATH.
The alternatives are:
- either prone to mistakes and side effects (setting a systemwide PYTHONPATH — what if I move my checkout?);
- or even more complicated to explain (mkvirtualenv djang && pip install -e .)
> It would leave a lot to explain to Windows users (which I note you are still
> trying to cater for).
If you're using the default options of the git installer on Windows, you're getting a fairly decent environment (MINGW32). It creates a "Git Bash" icon on the desktop, which starts a Bash shell where `git` works. After adding `export PATH=/c/Python27:$PATH` to `~/.bashrc`, `python` also works in that shell.
If we tell Windows users to use "Git Bash", we can skip most of the Windows-specific instructions. It's likely to make the tutorial a better experience for them.
Otherwise, `set PYTHONPATH=..` works in `cmd.exe`, but I can't recommend `cmd.exe` with a straight face :/
--
Aymeric.