#
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
#
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
#
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
class MEDCouplingDataForTest:
def build2DTargetMesh_1(cls):
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi, sqrt
with tempfile.TemporaryDirectory() as tmpdirname:
os.chdir(tmpdirname)
ret = func(*args,**kwargs)
+ # on windows, if we remain in this temporary directory
+ # Windows will lock it and deletion attempt will fail
+ if sys.platform == "win32":
+ os.chdir(os.path.dirname(tmpdirname))
pass
return ret
return decoratedFunc
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
import unittest
from math import pi,e,sqrt,cos,sin
from datetime import datetime
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
if MEDCouplingHasNumPyBindings():
from numpy import *
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
from MEDCouplingDataForTest import MEDCouplingDataForTest
if MEDCouplingHasNumPyBindings():
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
from math import pi, sqrt
# ! [PySnippetUMeshStdBuild1_1]
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
from math import pi, sqrt
from MEDLoader import *
from MEDCouplingRemapper import *
-import math, os
+import math, sys
import tempfile,os,shutil
zeDir = tempfile.mkdtemp()
print(sum(angle2)) ; assert abs(sum(angle2)-1.12)<1e-2
print("Au pdt (%d,%d) a %r s le couple est de : %r N.m, power/omega=%r N.m"%(ts[2][0],ts[2][1],ts[2][2],zeTorque[2],power/omega))
assert abs(power/omega-0.37)<1e-2
+
+# on windows, if we remain in this temporary directory
+# Windows will lock it and deletion attempt will fail
+if sys.platform == "win32":
+ os.chdir(os.path.dirname(zeDir))
shutil.rmtree(zeDir)
from MEDLoader import *
from math import pi,e,sqrt
+import sys
def WriteInTmpDir(func):
def decaratedFunc(*args,**kwargs):
with tempfile.TemporaryDirectory() as tmpdirname:
os.chdir(tmpdirname)
ret = func(*args,**kwargs)
+ # on windows, if we remain in this temporary directory
+ # Windows will lock it and deletion attempt will fail
+ if sys.platform == "win32":
+ os.chdir(os.path.dirname(tmpdirname))
pass
return ret
return decaratedFunc
#
from MEDLoader import *
-import os
-import tempfile,os,shutil
+import tempfile, os, sys, shutil
zeDir = tempfile.mkdtemp()
os.chdir(zeDir)
field=ff1TS.getFieldAtLevel(ON_CELLS,level)
field=ff1TS.getFieldOnMeshAtLevel(ON_CELLS,level,mm)
#! [UG_RWFieldAdv_5]
+
+# on windows, if we remain in this temporary directory
+# Windows will lock it and deletion attempt will fail
+if sys.platform == "win32":
+ os.chdir(os.path.dirname(zeDir))
shutil.rmtree(zeDir)
os.chdir(tmpdirname)
p = sp.check_output(full_path)
print(p.decode())
+ # on windows, if we remain in this temporary directory
+ # Windows will lock it and deletion attempt will fail
+ if sys.platform == "win32":
+ os.chdir(os.path.dirname(tmpdirname))
pass
if ( getenv("MEDCOUPLING_ROOT_DIR") )
{
execName=getenv("MEDCOUPLING_ROOT_DIR"); //.../INSTALL/MED
+#ifndef WIN32
execName+="/bin/medpartitioner";
+#else
+ execName+="\\bin\\medpartitioner.exe";
+#endif
std::ifstream my_file(execName.c_str());
if (my_file.good())
return execName;
}
execName = getcwd(NULL, 0);
+#ifndef WIN32
execName += "/../../MEDPartitioner/medpartitioner";
+#else
+ execName += "\\..\\..\\MEDPartitioner\\medpartitioner.exe";
+#endif
+
if (! std::ifstream(execName.c_str()))
CPPUNIT_FAIL("Can't find medpartitioner, please set MEDCOUPLING_ROOT_DIR");
return execName;
string cmd,execName,sourceName,targetName;
execName=getPartitionerExe();
-
+#ifndef WIN32
cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace
+#else
+ cmd="dir "+execName+" > NUL 2>&1"; //no trace
+#endif
res=system(cmd.c_str());
CPPUNIT_ASSERT_EQUAL_MESSAGE(execName + " - INVALID PATH TO medpartitioner", 0, res);
MEDPartitionerTest
)
+SET(PYTHONPATH $ENV{PYTHONPATH})
+IF(WIN32)
+ SET(PYTHONPATH "$ENV{PYTHONPATH};../../bin")
+ELSE(WIN32)
+ SET(PYTHONPATH "$ENV{PYTHONPATH}:../../bin")
+ENDIF(WIN32)
+
FOREACH(tfile ${TEST_NAMES})
SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
ADD_TEST(${TEST_NAME} python ${tfile}.py)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
LABELS "${COMPONENT_NAME}"
TIMEOUT ${TIMEOUT}
- ENVIRONMENT "PYTHONPATH=../../bin:$ENV{PYTHONPATH}"
+ ENVIRONMENT "${PYTHONPATH}"
+
)
ENDFOREACH()
def WriteInTmpDir(func):
def decaratedFunc(*args,**kwargs):
- import tempfile,os
+ import tempfile,os, sys
ret = None
with tempfile.TemporaryDirectory() as tmpdirname:
os.chdir(tmpdirname)
ret = func(*args,**kwargs)
+ # on windows, if we remain in this temporary directory
+ # Windows will lock it and deletion attempt will fail
+ if sys.platform == "win32":
+ os.chdir(os.path.dirname(tmpdirname))
pass
return ret
return decaratedFunc
def WriteInTmpDir(func):
def decoratedFunc(*args,**kwargs):
- import tempfile,os
+ import tempfile,os, sys
ret = None
with tempfile.TemporaryDirectory() as tmpdirname:
os.chdir(tmpdirname)
ret = func(*args,**kwargs)
+ # on windows, if we remain in this temporary directory
+ # Windows will lock it and deletion attempt will fail
+ if sys.platform == "win32":
+ os.chdir(os.path.dirname(tmpdirname))
pass
return ret
return decoratedFunc
MEDRenumberTest
)
+SET(PYTHONPATH $ENV{PYTHONPATH})
+IF(WIN32)
+ SET(PYTHONPATH "$ENV{PYTHONPATH};../../bin")
+ELSE(WIN32)
+ SET(PYTHONPATH "$ENV{PYTHONPATH}:../../bin")
+ENDIF(WIN32)
+
FOREACH(tfile ${TEST_NAMES})
SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ SET(TEST_ENVIRONMENT)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
LABELS "${COMPONENT_NAME}"
TIMEOUT ${TIMEOUT}
- ENVIRONMENT "PYTHONPATH=../../bin:$ENV{PYTHONPATH}"
+ ENVIRONMENT "${PYTHONPATH}"
)
ENDFOREACH()
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
LABELS "${COMPONENT_NAME}"
TIMEOUT ${TIMEOUT}
- ENVIRONMENT "PYTHONPATH=../../bin:$ENV{PYTHONPATH}"
+ ENVIRONMENT "${PYTHONPATH}"
)
import sys
-if sys.platform == "win32":
- from MEDCouplingCompat import *
-else:
- from medcoupling import *
+from medcoupling import *
from math import pi, sqrt