Skip to content

Commit

Permalink
Improve the test_groovy environment setup
Browse files Browse the repository at this point in the history
Until we have a proper environment builder, the bin/test.sh script can
set up the needed JARs, by pulling down the latest build + dependencies
from the remote Maven repository.
  • Loading branch information
ctrueden committed Jun 23, 2023
1 parent dd85f6e commit 901aecb
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/build/
/dist/
/eggs/
/target/
2 changes: 1 addition & 1 deletion bin/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ cd "$dir/.."
find . -name __pycache__ -type d | while read d
do rm -rfv "$d"
done
rm -rfv .pytest_cache build dist src/*.egg-info
rm -rfv .pytest_cache build dist src/*.egg-info target
28 changes: 28 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,34 @@ set -e
dir=$(dirname "$0")
cd "$dir/.."

if [ ! -d target/dependency ]
then
echo "==> Installing appose-java..."
mkdir -p target
echo '<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apposed</groupId>
<artifactId>appose-python</artifactId>
<version>0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apposed</groupId>
<artifactId>appose</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>scijava.public</id>
<url>https://maven.scijava.org/content/groups/public</url>
</repository>
</repositories>
</project>' > appose.pom
mvn -f appose.pom dependency:copy-dependencies
rm appose.pom
fi

if [ $# -gt 0 ]
then
python -m pytest -p no:faulthandler $@
Expand Down
11 changes: 2 additions & 9 deletions tests/test_appose.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,8 @@

def test_groovy():
env = appose.system()
# FIXME: Resolve these dependencies in a better way.
class_path = [
"../appose-java/target/appose-0.1.0-SNAPSHOT.jar",
"../appose-java/target/dependency/groovy-3.0.4.jar",
"../appose-java/target/dependency/groovy-json-3.0.4.jar",
"../appose-java/target/dependency/ivy-2.4.0.jar",
"../appose-java/target/dependency/jna-5.13.0.jar",
"../appose-java/target/dependency/jna-platform-5.13.0.jar",
]
# NB: For now, use bin/test.sh to copy the needed JARs.
class_path = ["target/dependency/*"]
with env.groovy(class_path=class_path) as service:
execute_and_assert(service, collatz_groovy)

Expand Down

0 comments on commit 901aecb

Please sign in to comment.