-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_package_validity.sh
37 lines (30 loc) · 1.04 KB
/
test_package_validity.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Check if expected package version argument is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <expected_package_version>"
exit 1
fi
# Assign the expected package version to a variable
EXPECTED_VERSION=$1
# Install the PositionData package
pip install PositionData
# Check the installed version against the expected version
INSTALLED_VERSION=$(pip show PositionData | grep Version | cut -d ' ' -f 2)
if [ "$INSTALLED_VERSION" != "$EXPECTED_VERSION" ]; then
echo "Version mismatch: Expected $EXPECTED_VERSION, got $INSTALLED_VERSION"
exit 1
fi
# Get the current Python version
PYTHON_VERSION=$(python --version)
echo "Running on $PYTHON_VERSION"
# Test Python script to instantiate classes
cat << EOF | python
from PositionData import PositionData, MethaneData, WindData, Trajectory
print("PositionData, MethaneData, WindData, Trajectory classes instantiated successfully.")
EOF
if [ $? -eq 0 ]; then
echo "Integration test passed on $PYTHON_VERSION."
else
echo "Integration test failed on $PYTHON_VERSION."
exit 1
fi