changeset 178:0d657576b1ac

tests directories are now searched for within archives
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 20 Jun 2011 17:52:09 +0300
parents 88e1e6786f67
children a55a1e00e121
files upreckon/files.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/upreckon/files.py	Mon Jun 20 16:00:45 2011 +0300
+++ b/upreckon/files.py	Mon Jun 20 17:52:09 2011 +0300
@@ -5,7 +5,7 @@
 from __future__ import division, with_statement
 
 from .compat import *
-import contextlib, os, shutil, sys
+import contextlib, os, posixpath, shutil, sys
 
 # You don't need to know about anything else.
 __all__ = 'File',
@@ -205,11 +205,10 @@
 					return True
 		return False
 	
-	def realize_path_archive(self, archive, root, virtpath, archpath):
+	def realize_path_archive(self, archive, root, virtpath, archpath, hastests=False):
 		if root and not archive.exists(root):
 			return False
-		if root: path = '/'.join((root, virtpath[0]))
-		else: path = virtpath[0]
+		path = posixpath.join(root, virtpath[0])
 		if len(virtpath) > 1:
 			if self.realize_path_archive(archive, path, virtpath[1:], archpath):
 				return True
@@ -221,6 +220,9 @@
 				self.real_path = path
 				self.full_real_path = os.path.join(archpath, *path.split('/'))
 				return True
+		if not hastests:
+			if self.realize_path_archive(archive, posixpath.join(root, 'tests'), virtpath, archpath, True):
+				return True
 		return False
 	
 	def open(self):