Skip to content

Instantly share code, notes, and snippets.

View chrisglass's full-sized avatar

Chris Glass chrisglass

View GitHub Profile
@chrisglass
chrisglass / without_home_protection.txt
Created July 21, 2018 08:03
With home protection turned off
ubuntu@web-caddy-1:/home/caddy$ ls -alih
total 26M
261382 drwxr-xr-x 4 www-data www-data 4.0K Jul 21 07:58 .
1613 drwxr-xr-x 4 root root 4.0K Jul 21 07:54 ..
261384 -rw-r--r-- 1 www-data www-data 220 Apr 4 18:30 .bash_logout
261385 -rw-r--r-- 1 www-data www-data 3.7K Apr 4 18:30 .bashrc
261383 -rw-r--r-- 1 www-data www-data 807 Apr 4 18:30 .profile
261430 drwxr-xr-x 2 www-data www-data 4.0K Jul 21 07:58 .ssh
261402 -rw-r--r-- 1 www-data 1001 22K Jul 20 14:20 CHANGES.txt
261403 -rw-r--r-- 1 www-data 1001 16K Jul 20 14:20 EULA.txt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pytest
def test_something():
with pytest.raises(BlahException) as blah:
do_something_that_raises()
with pytest.raises(BlahException) as blah:
do_something_that_raises() # This fails as if it didn't raise
import pytest
def test_something():
# Notice how the "as blah" is missing
with pytest.raises(BlahException):
do_something_that_raises()
with pytest.raises(BlahException):
do_something_that_raises() # This succeeds as if it raised.
class MonObjet:
blah = 1
something = "something"
instance = MonObjet()
instance.blah
def dbg(result):
"""
Recover the expression giving the result, and then
print a helpful debug statement showing this
"""
import inspect
frame = inspect.stack()[1]
expr = extract_dbg(frame.code_context[0])
filename = frame.filename.split("/")[-1]