changeset 14:8f53ae3e6696

Port tests to recent version of py.test
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 11 May 2013 20:28:56 +0200
parents 3d578fbfeb66
children 63f72bd28748
files hgstorage.py test_repo.py
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgstorage.py	Sun May 15 14:18:04 2011 +0200
+++ b/hgstorage.py	Sat May 11 20:28:56 2013 +0200
@@ -248,3 +248,4 @@
                     file_rev = -1
                 key = self.storage._file_to_key(filename)
                 yield key, (file_rev,) + self._get_meta(change)
+
--- a/test_repo.py	Sun May 15 14:18:04 2011 +0200
+++ b/test_repo.py	Sat May 11 20:28:56 2013 +0200
@@ -2,16 +2,13 @@
 # -*- coding: utf-8 -*-
 
 import os
-
-import py
 import py.test
 
 import hgstorage
 
+
 def clear_directory(top):
-    """
-    A helper function to remove a directory with all its contents.
-    """
+    """A helper function to remove a directory with all its contents."""
 
     for root, dirs, files in os.walk(top, topdown=False):
         for name in files:
@@ -27,8 +24,10 @@
     except OSError:
         pass
 
-def pytest_funcarg__storage(request):
-    path = str(request.config.ensuretemp('storage'))
+
+@py.test.fixture
+def storage(request):
+    path = str(py.test.ensuretemp('storage'))
     request.addfinalizer(lambda: clear_directory(path))
     storage = hgstorage.Storage(path)
     storage.create()
@@ -143,3 +142,4 @@
         assert u'message3' == history[1][1][3]
         assert u'message2' == history[2][1][3]
         assert u'message1' == history[3][1][3]
+