Skip to content

Instantly share code, notes, and snippets.


pablochacin pablochacin

View GitHub Profile
pablochacin /
Last active Aug 23, 2019
POC for dynamic pytest fixture scope definition


POC for dynamically defining the scope of a fixture based on a cli parameter.

session scope

pytest -s -v --scope=session
========================================= test session starts ==========================================
platform linux -- Python 3.6.5, pytest-5.0.0, py-1.5.2, pluggy-0.12.0 -- /usr/bin/python3
pablochacin /
Last active Jul 6, 2019
A minimalist BDD framework with fluent api
# Fluent BDD
Fluent BDD is a minimalistic testing framework with a fluent API.
A Scenario is defined as a sequence of Conditions, followed by
a series of Events and the Clauses that must be satiesfied at
the end. Multiple Conditions, Events and Clauses can be specified.
## Fluent API
View gist:ee0012bbcafa49e172c3
Verifying that +pablochacin is my openname (Bitcoin username).
pablochacin /
Last active Aug 28, 2020
A one liner to parse a http query string in bash
# the following one liner creates a shell variable from every parameter in a
# the query string in the variable QUERY, of the form p1=v1&p2=v2,... and sets it to
# the corresponding value so that parameters can be accessed by its name $p1, $p2, ...
for p in ${QUERY//&/ };do kvp=( ${p/=/ } ); k=${kvp[0]};v=${kvp[1]};eval $k=$v;done
pablochacin /
Last active Dec 25, 2015
A bash function to execute another function and kill it if it takes longer than a given timeout. Much like the timeout command, but works with functions.
#executes another function as a subprocess and kills it if takes longer than a given timeout
# $1 timeout
# $2 name of function
# $@ argument list for function
function watchdog(){
local T=$1
local F=$2
You can’t perform that action at this time.