Skip to content

Instantly share code, notes, and snippets.

View poliarush's full-sized avatar

Mykhailo Poliarush poliarush

View GitHub Profile
import sys, os
def main():
try:
f1 = open('ff1.txt')
f2 = open('ff2.txt')
f3 = open('ff3.txt')
except IOError, e:
print "file open error", e
sys.exit(1)
@Override
public void onTestFailure(ITestResult iTestResult) {
try {
Object testCase = iTestResult.getInstance();
Method testMethod = iTestResult.getMethod().getConstructorOrMethod().getMethod();
logger.error("Fail: " + testMethod.getName(), iTestResult.getThrowable());
invokeAnnotatedMethods(testCase, testMethod, AfterTestFailure.class);
} catch (Exception e) {
@poliarush
poliarush / gist:3798899
Created September 28, 2012 09:38
Code generation simple NUnit html report
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<h1>total is <xsl:value-of select="test-results/@total"/></h1>
<h1>errors: <xsl:value-of select="test-results/@errors"/></h1>
<h1>failures <xsl:value-of select="test-results/@failures"/></h1>
<h1>time taken <xsl:value-of select="test-results/test-suite/@time"/></h1>
<table>
py.test --capture=no --browser=ff -n 3 --junitxml=junit.xml .
a = 1,2,"3",4,"5"
l = []
for item in a:
l.append(int(item)*3)
print l[l.index(int(item)*3)]+10
import tst1
from pack import tst2
tst1.func("somethign")
reload (tst1)
tst2.func("somethign")
reload (tst2)
1. Пример
Текст текст
Текст текст
Текст текст
Текст текст
```
def method():
pass
@poliarush
poliarush / execution.bat
Last active August 29, 2015 14:07
Pyhon parallel run exeuciont via py.test for selenium webdriver
py.test -n 2 .
@poliarush
poliarush / conftest.py
Created December 25, 2014 18:35
How to create shared object instance thru fixture with pytest xdist
import pytest
from random import randint
import logging
import pickle
logging.basicConfig(filename="log.log", level=logging.INFO)
class App(object):
def __init__(self):
self.a = randint(0, 100)
import sys
import os
def main():
usage = """
You should pass at least 1 argument to %s
Arguments are folders full path separated by space.
""" % sys.argv[0]