Skip to content

Instantly share code, notes, and snippets.

@davidszotten
davidszotten / gist:02c101f0bc268a8d7741
Created November 16, 2014 18:15
coverage test run output
py27 runtests: commands[3] | /home/david/cov_src/.tox/py27/bin/python setup.py --quiet build_ext --inplace
py27 runtests: commands[4] | /home/david/cov_src/.tox/py27/bin/python igor.py test_with_tracer c
=== CPython 2.7.2+ with C tracer (.tox/py27/bin/python) ===
....................................................................................................................................................................................................................................................................................................................................................................E..........................................................................................
======================================================================
ERROR: test_subprocess_with_pth_files (tests.test_process.ProcessStartupTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/david/cov_src/tests/test_process.py", line
@davidszotten
davidszotten / monitor.py
Last active August 29, 2015 14:12
uwsgi dumper
#!/usr/bin/env python
import datetime
import os
import socket
import subprocess
import sys
ERROR = ' HTTP/1.1" 499'
$ cat covtest.py
import requests
requests.get('http://www.google.com')
$ coverage run -L covtest.py ; coverage report
Name Stmts Miss Cover
--------------------------------
covtest.py 2 0 100%
@davidszotten
davidszotten / conftest.py
Created May 14, 2015 10:50
pytest fixture lineage
def get_lineage(request):
name = request.fixturename
node = str(request.node)
try:
return [name] + get_lineage(request._parent_request)
except AttributeError:
return [node]
print ' <- '.join(get_lineage(request))
@davidszotten
davidszotten / README.txt
Created June 11, 2015 14:45
Nameko rpc step-through
add `import pdb; pdb.set_trace()` to `RpcConsumer.handle_message` and `ReplyListener.handle_message`
@davidszotten
davidszotten / gh_encrypt.sh
Created June 25, 2015 16:14
Encrypt with github public keys
#! /usr/bin/env bash
set -o nounset
set -o errexit
USER="$1"
INPUT_FILE="$2"
curl -s "https://github.com/$USER.keys" | tail -n 1 > "$USER.pub"
ssh-keygen -f "$USER.pub" -e -m PKCS8 > "$USER.pub.pem"
# https://s3.amazonaws.com/archive.travis-ci.org/jobs/127208999/log.txt
Using worker: worker-linux-docker-f359b10b.prod.travis-ci.org:travis-linux-4
travis_fold:start:system_info
Build system information
Build language: python
Build group: stable
Build dist: precise
Build image provisioning date and time
from django.core.management import call_command
from django.core.management.commands.makemigrations import Command
from django.db.migrations.writer import MigrationWriter
import mock
import pytest
def test_migrations_up_to_date():
# --exit exits if there are _no_ changes, which is what we are looking for
with pytest.raises(SystemExit):
@davidszotten
davidszotten / strip_rpc.py
Created August 10, 2016 20:43
strip amqp dependencies from nameko class
import inspect
from nameko.extensions import ENTRYPOINT_EXTENSIONS_ATTR
from nameko.rpc import rpc, RpcProxy, Rpc
from nameko.web.handlers import http
import requests
class HelloService(object):
name = "greeting_service"
@davidszotten
davidszotten / react_prof.js
Created August 16, 2016 09:32
React profiling bookmarklet
(function() {
var Perf = React.addons.Perf;
var is_active = window.reactProfileActive || false;
if (!is_active) {
Perf.start();
}
else {
Perf.start();
measurements = Perf.getLastMeasurements();
Perf.printInclusive(measurements);