File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ import sys
3+
14from setuptools import setup
5+ from setuptools .command .test import test as TestCommand
26
37
48def readme ():
@@ -11,6 +15,26 @@ def license_text():
1115 return f .read ()
1216
1317
18+ class Tox (TestCommand ):
19+ def initialize_options (self ):
20+ TestCommand .initialize_options (self )
21+ self .tox_args = None
22+
23+ def finalize_options (self ):
24+ TestCommand .finalize_options (self )
25+ self .test_args = []
26+ self .test_suite = True
27+
28+ def run_tests (self ):
29+ import tox
30+ import shlex
31+ args = self .tox_args
32+ if args :
33+ args = shlex .split (self .tox_args )
34+ errno = tox .cmdline (args )
35+ sys .exit (errno )
36+
37+
1438setup (name = 'simplepeg' ,
1539 version = '1.0.3' ,
1640 description = 'Python version of SimplePEG' ,
@@ -26,8 +50,8 @@ def license_text():
26502751 keywords = 'peg parser grammar' ,
2852 license = license_text (),
29- test_suite = 'nose.collector' ,
30- tests_require = [ 'nose' ] ,
53+ tests_require = [ 'pytest' , 'tox' ] ,
54+ cmdclass = { 'test' : Tox } ,
3155 packages = ['simplepeg' ],
3256 include_package_data = True ,
3357 zip_safe = False )
Original file line number Diff line number Diff line change 11from os import path as op
2+ import json
23
34import pytest
45
@@ -17,4 +18,4 @@ def test_speg(grammar_file):
1718 for postfix in ('' , '.txt' , '.json' )]
1819 speg = SPEG ()
1920 ast = speg .parse (grammar , text )
20- assert ast .to_json () == result
21+ assert json . loads ( ast .to_json ()) == json . loads ( result )
Original file line number Diff line number Diff line change 1+ [tox]
2+ envlist =py27
3+ [testenv]
4+ changedir =tests
5+ deps =pytest
6+ commands =py.test --basetemp ={envtmpdir}
7+ setenv = PYTHONPATH = {toxinidir}
You can’t perform that action at this time.
0 commit comments