After a bit of trial and error it turns out to be very simple:
python -W error foo.py
The above flag will turn all warnings into errors.
For more complex usage Doug Hellman has a good write up: http://doughellmann.com/PyMOTW/warnings/
$ psql postgres brad Can't exec "dpkg-architecture": No such file or directory at /usr/bin/psql line 103. Use of uninitialized value $multiarch in scalar chomp at /usr/bin/psql line 104. psql (9.1.3) Type "help" for help. postgres=#
sudo apt-get install dpkg-dev
import pytestIt fails saying:
@pytest.mark.parameterize(("input", "expected"), [
("3+5", 8),
("2+4", 6),
("6*9", 42),
])
def test_eval(input, expected):
assert eval(input) == expected
LookupError: no factory found for function argument 'input'What's going on here? It's spelt parametrize – not parameterize.
available funcargs: pytestconfig, capsys, capfd, tmpdir, monkeypatch, recwarn
use 'py.test --funcargs [testpath]' for help on them.
$ git clone file:///home/git/repositories/bar.gitAnd I would get output like this:
$ git clone file:///home/git/repositories/bar.git/ barThe issue was that although I had added myself to the git group, the permissions on the heads refs did not permit group read:
Initialized empty Git repository in /home/brad/bar/.git
remote: Counting objects: 1317, done.
remote: Compressing objects: 100% (1179/1179), done.
remote: Total 1317 (delta 601), reused 406 (delta 57)
Receiving objects: 100% (1317/1317), 5.37 MiB | 683 KiB/s, done.
Resolving deltas: 100% (601/601), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
$ ls -lha /home/git/repositories/bar.git/refs/headsSimple fix:
total 12K
drwx------ 2 git git 4.0K 2012-03-05 15:42 .
drwx------ 4 git git 4.0K 2012-02-28 14:21 ..
-rw------- 1 git git 41 2012-03-05 15:45 development
-rw------- 1 git git 41 2012-03-05 15:42 master
$ chmod g+r /home/git/repositories/bar.git/refs/heads/*So why was this suddenly a problem?