Skip to content

Commit dea989d

Browse files
committed
Post-rebase fixes for standalone tests
1 parent e624890 commit dea989d

File tree

3 files changed

+45
-47
lines changed

3 files changed

+45
-47
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_gradle_plugin.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@
4545
import unittest
4646

4747
from tests.standalone import util
48-
from tests.util import skip_deselected_test_functions
4948

5049

5150
def append(file, txt):
5251
with open(file, "a") as f:
5352
f.write(txt)
5453

5554
class GradlePluginTestBase(util.PolyglotAppTestBase):
56-
def setUpClass(self):
55+
@classmethod
56+
def setUpClass(cls):
5757
super().setUpClass()
58-
self.test_prj_path = os.path.join(os.path.dirname(__file__), "gradle", "gradle-test-project")
58+
cls.test_prj_path = os.path.join(os.path.dirname(__file__), "gradle", "gradle-test-project")
5959

6060
def target_dir_name_sufix(self, target_dir):
6161
pass
@@ -356,10 +356,11 @@ def check_gradle_empty_packages(self):
356356

357357
class GradlePluginGroovyTest(GradlePluginTestBase):
358358

359-
def setUpClass(self):
359+
@classmethod
360+
def setUpClass(cls):
360361
super().setUpClass()
361-
self.build_file_name = "build.gradle"
362-
self.settings_file_name = "settings.gradle"
362+
cls.build_file_name = "build.gradle"
363+
cls.settings_file_name = "settings.gradle"
363364

364365
@unittest.skipUnless(util.is_gradle_plugin_test_enabled, "ENABLE_GRADLE_PLUGIN_UNITTESTS is not true")
365366
def test_gradle_generated_app(self):
@@ -454,10 +455,11 @@ def empty_packages(self):
454455

455456
class GradlePluginKotlinTest(GradlePluginTestBase):
456457

457-
def setUpClass(self):
458+
@classmethod
459+
def setUpClass(cls):
458460
super().setUpClass()
459-
self.build_file_name = "build.gradle.kts"
460-
self.settings_file_name = "settings.gradle.kts"
461+
cls.build_file_name = "build.gradle.kts"
462+
cls.settings_file_name = "settings.gradle.kts"
461463

462464
@unittest.skipUnless(util.is_gradle_plugin_test_enabled, "ENABLE_GRADLE_PLUGIN_UNITTESTS is not true")
463465
def test_gradle_generated_app(self):
@@ -549,5 +551,3 @@ def empty_packages(self):
549551
packages
550552
}
551553
""")
552-
553-
skip_deselected_test_functions(globals())

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_maven_plugin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import unittest
4545

4646
from tests.standalone import util
47-
from tests.util import skip_deselected_test_functions
4847

4948

5049
class MavenPluginTest(util.PolyglotAppTestBase):
@@ -357,5 +356,3 @@ def test_empty_packages(self):
357356
cmd = mvnw_cmd + ["process-resources"]
358357
out, return_code = util.run_cmd(cmd, self.env, cwd=target_dir)
359358
util.check_ouput("BUILD SUCCESS", out)
360-
361-
skip_deselected_test_functions(globals())

graalpython/com.oracle.graal.python.test/src/tests/standalone/util.py

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
# SOFTWARE.
3939

4040
import os
41+
import shutil
4142
import subprocess
4243
import sys
4344
import unittest
4445
import urllib.parse
45-
import shutil
4646

4747
MAVEN_VERSION = "3.9.8"
4848
GLOBAL_MVN_CMD = [shutil.which('mvn'), "--batch-mode"]
@@ -55,75 +55,76 @@
5555
is_gradle_plugin_test_enabled = 'ENABLE_GRADLE_PLUGIN_UNITTESTS' in os.environ and os.environ['ENABLE_GRADLE_PLUGIN_UNITTESTS'] == "true"
5656

5757
class PolyglotAppTestBase(unittest.TestCase):
58-
def setUpClass(self):
58+
@classmethod
59+
def setUpClass(cls):
5960
if not is_maven_plugin_test_enabled and not is_gradle_plugin_test_enabled:
6061
return
6162

62-
self.env = os.environ.copy()
63-
self.env["PYLAUNCHER_DEBUG"] = "1"
63+
cls.env = os.environ.copy()
64+
cls.env["PYLAUNCHER_DEBUG"] = "1"
6465

65-
self.archetypeGroupId = "org.graalvm.python"
66-
self.archetypeArtifactId = "graalpy-archetype-polyglot-app"
67-
self.pluginArtifactId = "graalpy-maven-plugin"
68-
self.graalvmVersion = get_graalvm_version()
66+
cls.archetypeGroupId = "org.graalvm.python"
67+
cls.archetypeArtifactId = "graalpy-archetype-polyglot-app"
68+
cls.pluginArtifactId = "graalpy-maven-plugin"
69+
cls.graalvmVersion = get_graalvm_version()
6970

7071
for custom_repo in os.environ.get("MAVEN_REPO_OVERRIDE", "").split(","):
7172
url = urllib.parse.urlparse(custom_repo)
7273
if url.scheme == "file":
7374
jar = os.path.join(
7475
url.path,
75-
self.archetypeGroupId.replace(".", os.path.sep),
76-
self.archetypeArtifactId,
77-
self.graalvmVersion,
78-
f"{self.archetypeArtifactId}-{self.graalvmVersion}.jar",
76+
cls.archetypeGroupId.replace(".", os.path.sep),
77+
cls.archetypeArtifactId,
78+
cls.graalvmVersion,
79+
f"{cls.archetypeArtifactId}-{cls.graalvmVersion}.jar",
7980
)
8081
pom = os.path.join(
8182
url.path,
82-
self.archetypeGroupId.replace(".", os.path.sep),
83-
self.archetypeArtifactId,
84-
self.graalvmVersion,
85-
f"{self.archetypeArtifactId}-{self.graalvmVersion}.pom",
83+
cls.archetypeGroupId.replace(".", os.path.sep),
84+
cls.archetypeArtifactId,
85+
cls.graalvmVersion,
86+
f"{cls.archetypeArtifactId}-{cls.graalvmVersion}.pom",
8687
)
8788
cmd = GLOBAL_MVN_CMD + [
8889
"install:install-file",
8990
f"-Dfile={jar}",
90-
f"-DgroupId={self.archetypeGroupId}",
91-
f"-DartifactId={self.archetypeArtifactId}",
92-
f"-Dversion={self.graalvmVersion}",
91+
f"-DgroupId={cls.archetypeGroupId}",
92+
f"-DartifactId={cls.archetypeArtifactId}",
93+
f"-Dversion={cls.graalvmVersion}",
9394
"-Dpackaging=jar",
9495
f"-DpomFile={pom}",
9596
"-DcreateChecksum=true",
9697
]
97-
out, return_code = run_cmd(cmd, self.env)
98+
out, return_code = run_cmd(cmd, cls.env)
9899
assert return_code == 0
99100

100101
jar = os.path.join(
101102
url.path,
102-
self.archetypeGroupId.replace(".", os.path.sep),
103-
self.pluginArtifactId,
104-
self.graalvmVersion,
105-
f"{self.pluginArtifactId}-{self.graalvmVersion}.jar",
103+
cls.archetypeGroupId.replace(".", os.path.sep),
104+
cls.pluginArtifactId,
105+
cls.graalvmVersion,
106+
f"{cls.pluginArtifactId}-{cls.graalvmVersion}.jar",
106107
)
107108

108109
pom = os.path.join(
109110
url.path,
110-
self.archetypeGroupId.replace(".", os.path.sep),
111-
self.pluginArtifactId,
112-
self.graalvmVersion,
113-
f"{self.pluginArtifactId}-{self.graalvmVersion}.pom",
111+
cls.archetypeGroupId.replace(".", os.path.sep),
112+
cls.pluginArtifactId,
113+
cls.graalvmVersion,
114+
f"{cls.pluginArtifactId}-{cls.graalvmVersion}.pom",
114115
)
115116

116117
cmd = GLOBAL_MVN_CMD + [
117118
"install:install-file",
118119
f"-Dfile={jar}",
119-
f"-DgroupId={self.archetypeGroupId}",
120-
f"-DartifactId={self.pluginArtifactId}",
121-
f"-Dversion={self.graalvmVersion}",
120+
f"-DgroupId={cls.archetypeGroupId}",
121+
f"-DartifactId={cls.pluginArtifactId}",
122+
f"-Dversion={cls.graalvmVersion}",
122123
"-Dpackaging=jar",
123124
f"-DpomFile={pom}",
124125
"-DcreateChecksum=true",
125126
]
126-
out, return_code = run_cmd(cmd, self.env)
127+
out, return_code = run_cmd(cmd, cls.env)
127128
assert return_code == 0
128129
break
129130

@@ -285,4 +286,4 @@ def patch_properties_file(properties_file, distribution_url_override):
285286
else:
286287
new_lines.append(line)
287288
with(open(properties_file, "w")) as f:
288-
f.writelines(new_lines)
289+
f.writelines(new_lines)

0 commit comments

Comments
 (0)