Skip to content

Instantly share code, notes, and snippets.

def is_docker():
path = f'/proc/{os.getpid()}/cgroup'
pattern = re.compile(r'\d+:\w+:/docker/\w+')
return os.path.isfile(path) and any(map(pattern.match, open(path)))
$ cat > test_stuff.py
">>> 3\n3"
def test_stuff():
import pdb; pdb.set_trace()
$ ~/p/pytest/.tox/python/bin/pytest --capture=no
====================================== test session starts =======================================
platform darwin -- Python 3.6.4, pytest-3.4.1.dev34+gce1872e7.d20180213, py-1.5.2, pluggy-0.6.0
rootdir: /Users/jaraco/Dropbox/code/public/pytest, inifile: tox.ini
plugins: hypothesis-3.44.26
$ ~/p/pytest/.tox/python/bin/pytest -p no:capturemanager
====================================== test session starts =======================================
platform darwin -- Python 3.6.4, pytest-3.4.1.dev34+gce1872e7.d20180213, py-1.5.2, pluggy-0.6.0
rootdir: /Users/jaraco/Dropbox/code/public/pytest, inifile: tox.ini
plugins: hypothesis-3.44.26
collected 1 item
test_stuff.py
>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--Return--
$ tox -r -- -k test_4_Auto
python recreate: /Users/jaraco/Dropbox/code/public/cherrypy/.tox/python
python develop-inst: /Users/jaraco/Dropbox/code/public/cherrypy
python installed: attrs==17.4.0,backports.unittest-mock==1.3,certifi==2018.1.18,chardet==3.0.4,cheroot==6.0.0,-e git+gh://cherrypy/cherrypy@816378ebbbcb775379293dd30c9da0bcef02e156#egg=CherryPy,codecov==2.0.15,coverage==4.5.1,graphviz==0.8.2,idna==2.6,more-itertools==4.1.0,objgraph==3.4.0,path.py==11.0,pluggy==0.6.0,portend==2.2,py==1.5.2,pytest==3.4.0,pytest-cov==2.5.1,pytest-sugar==0.9.1,pytz==2018.3,repoze.lru==0.7,requests==2.18.4,Routes==2.4.1,six==1.11.0,tempora==1.10,termcolor==1.1.0,urllib3==1.22
python runtests: PYTHONHASHSEED='3944111983'
python runtests: commands[0] | pytest -k test_4_Auto
Test session starts (platform: darwin, Python 3.7.0, pytest 3.4.0, pytest-sugar 0.9.1)
cachedir: .pytest_cache
rootdir: /Users/jaraco/Dropbox/code/public/cherrypy, inifile: pytest.ini
plugins: sugar-0.9.1, cov-2.5.1, backports.unittest-mo
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
https://gist.github.com/1a2cf7c28897f6dfd539b0e742a7e4d8
https://gist.github.com/1a2cf7c28897f6dfd539b0e742a7e4d8
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'canary',
$ git diff
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 5ad94aba64..9851661d88 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -7,6 +7,7 @@ import doctest
import functools
import os
import sys
+import importlib