Skip to content

Instantly share code, notes, and snippets.

@magixx
magixx / fix_as_fix_param.py
Created January 9, 2015 20:42
Fixtures as Fixture Paramaters
import pytest
@pytest.fixture(scope="class")
def resource_a(request):
r = {'name': 'A'}
def fin():
print ("\nteardown " + r['name'])
request.addfinalizer(fin)
return r
@magixx
magixx / Parameters_from_fix.py
Last active August 29, 2015 14:13
Parameters from functions in fixture
import ipdb
import pytest
@pytest.fixture(scope='function')
def resource_a(request):
default_value = '2'
if request.scope == 'function' and 'value' in request.funcargnames:
default_value = request.getfuncargvalue('value')
@magixx
magixx / number_clustering.py
Last active August 29, 2015 14:12
String number matching magic for scene releases
import regex
test_release = 'Release.Name.v1.3.0.DISC.1.Other.Tags.x.264.<RESOLUTION>.WMV'
memory = []
main = []
split_release = test_release.split('.')
split_release.reverse()
split_release_copy = split_release[:]
# Tags that I want to know about