@@ -92,7 +92,8 @@ def __init__(self, root, file=None, filter=None, level=0, parent=None,
9292 @param fLOG logging function to use
9393 """
9494 if root is None :
95- raise ValueError ("root cannot be None" )
95+ raise ValueError ( # pragma: no cover
96+ "root cannot be None." )
9697 self ._root = root
9798 self ._file = None if file is None else file
9899 self ._children = []
@@ -109,12 +110,14 @@ def __init__(self, root, file=None, filter=None, level=0, parent=None,
109110 if not os .path .exists (root ):
110111 raise PQHException ("path '%s' does not exist" % root )
111112 if not os .path .isdir (root ):
112- raise PQHException ("path '%s' is not a folder" % root )
113+ raise PQHException ( # pragma: no cover
114+ "path '%s' is not a folder" % root )
113115
114116 if self ._file is not None :
115117 if not self .exists ():
116- raise PQHException (
117- "%s does not exist [%s,%s]" % (self .get_fullname (), root , file ))
118+ raise PQHException ( # pragma: no cover
119+ "%s does not exist [%s,%s]" % (
120+ self .get_fullname (), root , file ))
118121
119122 self ._fillstat ()
120123 if self .isdir ():
@@ -277,8 +280,9 @@ def _fill(self, filter, repository):
277280 @param repository use svn or git
278281 """
279282 if not self .isdir ():
280- raise PQHException (
281- "unable to look into a file %s full %s" % (self ._file , self .get_fullname ()))
283+ raise PQHException ( # pragma: no cover
284+ "Unable to look into a file %r full %r." % (
285+ self ._file , self .get_fullname ()))
282286
283287 if repository :
284288 opt = "repo_ls"
@@ -309,7 +313,7 @@ def _fill(self, filter, repository):
309313 n = FileTreeNode (self ._root , os .path .join (fi , a ), filter , level = self ._level + 1 ,
310314 parent = self , repository = repository , log = self ._log ,
311315 log1 = self ._log1 or self ._log , fLOG = self .fLOG )
312- except PQHException as e :
316+ except PQHException as e : # pragma: no cover
313317 if "does not exist" in str (e ):
314318 self .fLOG (
315319 "a folder should exist, but is it is not, it continues [opt=%s]" % opt )
@@ -475,7 +479,7 @@ def remove(self):
475479 self .fLOG ("removing " , full )
476480 try :
477481 os .remove (full )
478- except OSError as e :
482+ except OSError as e : # pragma: no cover
479483 self .fLOG (
480484 "unable to remove " , full , " --- " , str (e ).replace ("\n " , " " ))
481485 self .fLOG ("[pyqerror] " , e )
@@ -494,10 +498,11 @@ def copy_to(self, path, exc=True):
494498 the new file is older.
495499 """
496500 if not os .path .exists (path ):
497- raise PQHException ("this path does not exist: '{0}'" .format (path ))
501+ raise PQHException ( # pragma: no cover
502+ "This path does not exist: '{0}'." .format (path ))
498503 if self .isdir ():
499- raise PQHException (
500- "this node represents a folder " + self .get_fullname ())
504+ raise PQHException ( # pragma: no cover
505+ "This node represents a folder %r." % self .get_fullname ())
501506 full = self .get_fullname ()
502507 temp = os .path .split (self ._file )[0 ]
503508 dest = os .path .join (path , temp )
@@ -522,7 +527,7 @@ def copy_to(self, path, exc=True):
522527 if t1 > t2 and exc :
523528 raise PQHException (mes )
524529 warnings .warn (mes , RuntimeWarning )
525- except OSError as e :
530+ except OSError as e : # pragma: no cover
526531 # else :
527532 self .fLOG ("unable to copy file " , full , " to " , path )
528533 self .fLOG ("[pyqerror]" , e )
0 commit comments