Commits

Jonathan Eunice committed bb68e3c

working with tox

Comments (0)

Files changed (4)

 *.egg-info
 setup.cfg
 PKG-INFO
+.tox
 
 setup(
     name='say',
-    version=verno("0.133"),
+    version=verno("0.183"),
     author='Jonathan Eunice',
     author_email='jonathan.eunice@gmail.com',
     description='Simple formatted printing with templates',
     url='https://bitbucket.org/jeunice/say',
     py_modules=['say'],
     install_requires=['six','options','otherstuf'],
+    tests_require = ['pytest'],
+    zip_safe = True,
+    keywords='print format template say',
     classifiers=linelist("""
         Development Status :: 3 - Alpha
         Operating System :: OS Independent
-from testharness import import_from_parent, test_run
 
-import_from_parent()
 
-import six
+import six, os
 from say import Say, fmt, stdout
 
 def setup():
     assert say('I am a truck!', encoding='rot-13') == 'V nz n gehpx!'
     assert say('V nz n gehpx!', encoding='rot-13') == 'I am a truck!'
     
-def test_files():
+def test_files(tmpdir):
     say = Say()
-    say.setfiles([stdout, 'test.txt'])
+    
+    # tmpfilepath = os.path.join(str(tmpdir.realpath()), 'test.txt')
+    # tmpfilepath = str(tmpdir.join('test.txt').realpath())
+    tmpfile = tmpdir.join('test.txt')
+    #print tmpdir
+    #print dir(tmpdir)
+    #print tmpdir.realpath()
+    say.setfiles([stdout, tmpfile])
     say("Yowza!")
     
     # hack to close files and make ready for reading / testing
-    say.options.files[1].close()
-    say.options.files = say.options.files[0:1]
+    # say.options.files[1].close()
+    # say.options.files = say.options.files[0:1]
     
-    text = open('test.txt').read()
-    print "text:", repr(text)
-    assert text == "Yowza!" + "\n"  # file output gets \n - account for that
+    # text = open(tmpfilepath).read()
+    # print "text:", repr(text)
+    # assert text == "Yowza!" + "\n"  # file output gets \n - account for that
+    assert tmpfile.read() == "Yowza!" + "\n" 
 
 def test_example_1():
     setup()
     r2 = say("this is output", silent=True)
     assert r1 == r2
   
-if __name__ == '__main__':
-    globalvar = 99
-    test_run()
+globalvar = 99
+[tox]
+envlist = py26, py27, py33
+
+[testenv]
+changedir=test
+deps=pytest       # install pytest in the venvs
+commands=py.test