@@ -452,10 +452,9 @@ def cmdline(self, ret, info):
452
452
self .assertIsInstance (part , str )
453
453
454
454
def exe (self , ret , info ):
455
- self .assertIsInstance (ret , (str , unicode , type (None )))
456
- if not ret :
457
- self .assertEqual (ret , '' )
458
- else :
455
+ self .assertIsInstance (ret , (str , unicode ))
456
+ self .assertEqual (ret .strip (), ret )
457
+ if ret :
459
458
if WINDOWS and not ret .endswith ('.exe' ):
460
459
return # May be "Registry", "MemCompression", ...
461
460
assert os .path .isabs (ret ), ret
@@ -520,7 +519,8 @@ def gids(self, ret, info):
520
519
521
520
def username (self , ret , info ):
522
521
self .assertIsInstance (ret , str )
523
- assert ret
522
+ self .assertEqual (ret .strip (), ret )
523
+ assert ret .strip ()
524
524
525
525
def status (self , ret , info ):
526
526
self .assertIsInstance (ret , str )
@@ -619,6 +619,7 @@ def open_files(self, ret, info):
619
619
for f in ret :
620
620
self .assertIsInstance (f .fd , int )
621
621
self .assertIsInstance (f .path , str )
622
+ self .assertEqual (f .path .strip (), f .path )
622
623
if WINDOWS :
623
624
self .assertEqual (f .fd , - 1 )
624
625
elif LINUX :
@@ -651,8 +652,9 @@ def connections(self, ret, info):
651
652
check_connection_ntuple (conn )
652
653
653
654
def cwd (self , ret , info ):
654
- if ret : # 'ret' can be None or empty
655
- self .assertIsInstance (ret , str )
655
+ self .assertIsInstance (ret , (str , unicode ))
656
+ self .assertEqual (ret .strip (), ret )
657
+ if ret :
656
658
assert os .path .isabs (ret ), ret
657
659
try :
658
660
st = os .stat (ret )
0 commit comments