File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ clean: ## Remove all build files.
4747 dist/ \
4848 docs/_build/ \
4949 htmlcov/ \
50+ pytest-cache-files* \
5051 wheelhouse
5152
5253.PHONY : build
Original file line number Diff line number Diff line change 1515import argparse
1616import atexit
1717import ctypes
18- import errno
1918import fnmatch
2019import os
2120import shutil
@@ -124,16 +123,21 @@ def rm(pattern, directory=False):
124123def safe_remove (path ):
125124 try :
126125 os .remove (path )
127- except OSError as err :
128- if err .errno != errno .ENOENT :
129- raise
126+ except FileNotFoundError :
127+ pass
128+ except PermissionError as err :
129+ print (err )
130130 else :
131131 safe_print (f"rm { path } " )
132132
133133
134134def safe_rmtree (path ):
135+ def onerror (func , path , err ):
136+ if not issubclass (err [0 ], FileNotFoundError ):
137+ print (err [1 ])
138+
135139 existed = os .path .isdir (path )
136- shutil .rmtree (path , ignore_errors = True )
140+ shutil .rmtree (path , onerror = onerror )
137141 if existed and not os .path .isdir (path ):
138142 safe_print (f"rmdir -f { path } " )
139143
@@ -282,6 +286,7 @@ def clean():
282286 "*__pycache__" ,
283287 ".coverage" ,
284288 ".failed-tests.txt" ,
289+ "pytest-cache-files*" ,
285290 )
286291 safe_rmtree ("build" )
287292 safe_rmtree (".coverage" )
@@ -318,11 +323,7 @@ def test(args=None):
318323def test_by_name (arg ):
319324 """Run specific test by name."""
320325 build ()
321- sh ([
322- PYTHON ,
323- "-m" ,
324- "pytest" ,
325- ])
326+ sh ([PYTHON , "-m" , "pytest" , arg ])
326327
327328
328329def test_by_regex (arg ):
Original file line number Diff line number Diff line change 114114 "vulture" ,
115115 "wheel" ,
116116 "pyreadline ; os_name == 'nt'" ,
117- "pdbpp ; os_name == 'nt'" ,
118117]
119118
120119macros = []
You can’t perform that action at this time.
0 commit comments