Skip to content

Commit 8701067

Browse files
committed
Tests don't run mvn if JAVAOBJ_NO_MAVEN is set
If the JAVAOBJ_NO_MAVEN environment variable is set to a non-empty value, the .ser files won't be generated with Maven. This allows testing only with the repository files.
1 parent c35af30 commit 8701067

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

tests/tests.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ def setUpClass(cls):
6969
# Compute the java directory
7070
java_dir = os.path.join(os.path.dirname(__file__), "java")
7171

72-
# Run Maven and go back to the working folder
73-
cwd = os.getcwd()
74-
os.chdir(java_dir)
75-
subprocess.call("mvn test", shell=True)
76-
os.chdir(cwd)
72+
if not os.getenv("JAVAOBJ_NO_MAVEN"):
73+
# Run Maven and go back to the working folder
74+
cwd = os.getcwd()
75+
os.chdir(java_dir)
76+
subprocess.call("mvn test", shell=True)
77+
os.chdir(cwd)
7778

7879
def read_file(self, filename, stream=False):
7980
"""

tests/tests_v2.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def __init__(self):
142142
self.name = "java.util.Random"
143143
self.field_names = ['haveNextNextGaussian', 'nextNextGaussian', 'seed']
144144
self.field_types = [
145-
javaobj.beans.FieldType.BOOLEAN,
145+
javaobj.beans.FieldType.BOOLEAN,
146146
javaobj.beans.FieldType.DOUBLE,
147147
javaobj.beans.FieldType.LONG
148148
]
@@ -181,11 +181,12 @@ def setUpClass(cls):
181181
# Compute the java directory
182182
java_dir = os.path.join(os.path.dirname(__file__), "java")
183183

184-
# Run Maven and go back to the working folder
185-
cwd = os.getcwd()
186-
os.chdir(java_dir)
187-
subprocess.call("mvn test", shell=True)
188-
os.chdir(cwd)
184+
if not os.getenv("JAVAOBJ_NO_MAVEN"):
185+
# Run Maven and go back to the working folder
186+
cwd = os.getcwd()
187+
os.chdir(java_dir)
188+
subprocess.call("mvn test", shell=True)
189+
os.chdir(cwd)
189190

190191
def read_file(self, filename, stream=False):
191192
"""

0 commit comments

Comments
 (0)