← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3606: Check file existance before its moving and removing.

 

------------------------------------------------------------
revno: 3606
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2015-03-03 20:37:20 +0100
message:
  Check file existance before its moving and removing.
  
  More intelligent logic of cleaning the current folder
  after --test and --check commands.
modified:
  core/main/main.py.in
  scripts/checks-and-tests/checks/checkTestTriax.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2015-03-02 14:54:02 +0000
+++ core/main/main.py.in	2015-03-03 19:37:20 +0000
@@ -96,8 +96,8 @@
 		import traceback; traceback.print_exc()
 		print 20*'*'+' Thank you '+20*'*'
 		sys.exit(2)
-	os.remove('DirSearchYade')
-	os.remove('MicroMacroAnalysis')
+	if (os.path.exists('./DirSearchYade')): os.remove('./DirSearchYade')
+	if (os.path.exists('./MicroMacroAnalysis')): os.remove('./MicroMacroAnalysis')
 	if result.wasSuccessful():
 		print "*** ALL TESTS PASSED ***"
 		sys.exit(0)

=== modified file 'scripts/checks-and-tests/checks/checkTestTriax.py'
--- scripts/checks-and-tests/checks/checkTestTriax.py	2015-03-02 14:54:02 +0000
+++ scripts/checks-and-tests/checks/checkTestTriax.py	2015-03-03 19:37:20 +0000
@@ -32,8 +32,7 @@
 	resultStatus +=1	#Test is failed
 
 dirpath = tempfile.mkdtemp()
-shutil.move('checkTest.yade',dirpath)
-shutil.move('_Unloaded_380_3.spheres',dirpath)
-shutil.move('_Unloaded_380_3.xml',dirpath)
-shutil.move('WallStresses',dirpath)
-print "Files checkTest.yade, _Unloaded_380_3.spheres, _Unloaded_380_3.xml and WallStresses are moved into %s/ directory"%dirpath
+
+for fileName in ['./checkTest.yade', './_Unloaded_380_3.spheres', './_Unloaded_380_3.xml', './WallStresses', ]:
+  if (os.path.exists(fileName)): shutil.move(fileName,dirpath)
+  print "File %s moved into %s/ directory"%(fileName,dirpath)