Skip to content

Instantly share code, notes, and snippets.

View hpk42's full-sized avatar

holger krekel hpk42

View GitHub Profile
>>> import xmlrpclib
>>> proxy=xmlrpclib.ServerProxy("https://preview-pypi.python.org/pypi")
>>> d=proxy.list_packages_with_serial()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py
--- a/_pytest/assertion/__init__.py
+++ b/_pytest/assertion/__init__.py
@@ -78,10 +78,12 @@ def pytest_runtest_setup(item):
for new_expl in hook_result:
if new_expl:
- # Don't include pageloads of data unless we are very verbose (-vv)
+ # Don't include pageloads of data unless we
+ # are very verbose (-vv)
(py33)hpk@teta:/tmp/test_gen0$ python mypytest.py -n1 test_x.py
============================= test session starts ==============================
platform linux -- Python 3.3.2 -- pytest-2.4.3.dev2
plugins: xdist, instafail, capturelog, cache
gw0 C[gw0] node down: Traceback (most recent call last):
File "/home/hpk/venv/py33/local/lib/python3.3/site-packages/execnet/gateway_base.py", line 800, in executetask
do_exec(co, loc)
File "<string>", line 1, in do_exec
File "<remote exec>", line 139, in <module>
File "<remote exec>", line 117, in remote_initconfig
import pytest
import mock
@mock.patch("os.path.abspath")
def test_one(mock_abspath):
pass
@mock.patch("os.path.abspath")
def test_two(mock_abspath):
pass
import execnet
def execnet_main(channel):
import inspect
import sys
f = sys._getframe()
frames = []
while f:
(0)hpk@teta:~/p/pytest$ cat test_x.py
def test_assert():
x = 3
assert x == 4
(0)hpk@teta:~/p/pytest$ python -OO -m pytest test_x.py
WARNING: assertions which are not in test modules will be ignored because assert statements are not executed by the underlying Python interpreter (are you using python -O?)
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- pytest-2.4.3.dev2
import pytest
def test_hello(tmpdir):
print "hello using", tmpdir
assert 0
if __name__ == "__main__":
pytest.main(["--pyargs", "x"])
import pytest
with pytest.FixtureContext("db", path="...") as db:
# work with db
any finalizers will be called at the end of the with statement
etamax_cassette = pytest.mark.betamax_cassette
class TestGitHubAPI:
def test_user(self, session, vcr):
vcr.use_cassette('user')
resp = session.get('https://api.github.com/user',
auth=('user', 'pass'))
assert resp.json()['login'] is not None
class TestGitHubAPI:
def test_user(self, vcr):
vcr.use_cassette('user')
resp = self.session.get('https://api.github.com/user',
auth=('user', 'pass'))
assert resp.json()['login'] is not None
@betamax_cassette("repo")
def test_repo(self):
resp = self.session.get(