~crunch.io/ubuntu/precise/codespeak-lib/unstable

« back to all changes in this revision

Viewing changes to py/_plugin/pytest_genscript.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-08-01 16:24:01 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100801162401-g37v49d1p148alpm
Tags: 1.3.3-1
* New upstream release.
* Bump Standards-Version to 3.9.1.
* Fix typo in py.test manpage.
* Prefer Breaks: over Conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
"""
3
 
generate standalone test script to be distributed along with an application. 
 
3
generate standalone test script to be distributed along with an application.
4
4
"""
5
5
 
6
6
import os
7
 
import zlib
8
 
import base64
9
7
import sys
10
 
try:
11
 
    import pickle
12
 
except Importerror:
13
 
    import cPickle as pickle
14
 
 
15
8
def pytest_addoption(parser):
16
9
    group = parser.getgroup("debugconfig")
17
 
    group.addoption("--genscript", action="store", default=None, 
18
 
        dest="genscript", metavar="path", 
 
10
    group.addoption("--genscript", action="store", default=None,
 
11
        dest="genscript", metavar="path",
19
12
        help="create standalone py.test script at given target path.")
20
13
 
21
14
def pytest_configure(config):
30
23
        raise SystemExit(0)
31
24
 
32
25
def main(pybasedir, outfile, infile):
 
26
    import base64
 
27
    import zlib
 
28
    try:
 
29
        import pickle
 
30
    except Importerror:
 
31
        import cPickle as pickle
 
32
 
33
33
    outfile = str(outfile)
34
34
    infile = str(infile)
35
35
    assert os.path.isabs(outfile)
39
39
        for f in filenames:
40
40
            if not f.endswith(".py"):
41
41
                continue
42
 
                
 
42
 
43
43
            fn = os.path.join(dirpath, f)
44
44
            files.append(fn)
45
45