Skip to content

Commit df99670

Browse files
committed
Additional Maven test for packages trimming
1 parent df6ca1e commit df99670

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

integration-tests/test_maven_plugin.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ def test_multiple_vfs_incompat_libs_error(self):
784784
assert return_code != 0
785785

786786

787-
788787
def test_multiple_namespaced_vfs(self):
789788
if not util.native_image_all():
790789
self.skipTest("native-image tests disabled")
@@ -879,6 +878,24 @@ def test_requirements_txt_packages(self):
879878
assert return_code == 0
880879

881880

881+
def test_packages_trimming(self):
882+
with util.TemporaryTestDirectory() as tmpdir:
883+
target_name = "packages_trimming_test"
884+
target_dir = os.path.join(str(tmpdir), target_name)
885+
self.generate_app(tmpdir, target_dir, target_name)
886+
887+
pom = os.path.join(target_dir, "pom.xml")
888+
# Add empty and whitespace entries around the valid package
889+
util.replace_in_file(pom, "</packages>", "<package></package><package> </package></packages>")
890+
891+
mvnw_cmd = util.get_mvn_wrapper(target_dir, self.env)
892+
out, return_code = util.run_cmd(mvnw_cmd + ["process-resources"], self.env, cwd=target_dir)
893+
util.check_ouput("BUILD SUCCESS", out)
894+
# Sanity: ensure install was attempted from inline packages
895+
util.check_ouput("pip install", out)
896+
assert return_code == 0
897+
898+
882899
if __name__ == "__main__":
883900
run_path = os.path.join(os.path.abspath(__file__), 'run.py')
884901
print(f"Run this file using the run.py driver ({run_path})")

0 commit comments

Comments
 (0)