Skip to content

Commit 4ed560f

Browse files
add tests
1 parent 7686d3c commit 4ed560f

7 files changed

Lines changed: 64 additions & 3 deletions

File tree

src/oryx/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export DEBIAN_FRONTEND=noninteractive
118118

119119

120120
# Install dependencies
121-
check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin
121+
check_packages git sudo curl ca-certificates apt-transport-https gnupg2 dirmngr libc-bin moreutils
122122

123123
if ! cat /etc/group | grep -e "^oryx:" > /dev/null 2>&1; then
124124
groupadd -r oryx

src/python/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "python",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"name": "Python",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
66
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",

src/python/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export PIPX_HOME=${PIPX_HOME:-"/usr/local/py-utils"}
1717

1818
USERNAME=${USERNAME:-"automatic"}
1919
UPDATE_RC=${UPDATE_RC:-"true"}
20-
USE_ORYX_IF_AVAILABLE=${USE_ORYX_IF_AVAILABLE:-"true"}
20+
USE_ORYX_IF_AVAILABLE=${USEORYXIFAVAILABLE:-"true"}
2121

2222
INSTALL_JUPYTERLAB=${INSTALLJUPYTERLAB:-"false"}
2323
CONFIGURE_JUPYTERLAB_ALLOW_ORIGIN=${CONFIGUREJUPYTERLABALLOWORIGIN:-""}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mpmath==1.2.1
2+
sympy==1.11.1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from sympy import Symbol, Eq, solve
2+
3+
x = Symbol("x")
4+
y = Symbol("y")
5+
6+
equation_1 = Eq((x + y), 2)
7+
equation_2 = Eq((x - y), 4)
8+
print("Equation 1:", equation_1)
9+
print("Equation 2:", equation_2)
10+
11+
solution = solve((equation_1, equation_2), (x, y))
12+
print("Solution:", solution)

test/oryx/scenarios.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,20 @@
88
},
99
"oryx": {}
1010
}
11+
},
12+
"test_python_project": {
13+
"image": "ubuntu:focal",
14+
"features": {
15+
"python": {
16+
"version": "3.10.4",
17+
"additionalVersions": "3.9.7",
18+
"useOryxIfAvailable": "false"
19+
},
20+
"dotnet": {
21+
"version": "7",
22+
"installUsingApt": "false"
23+
},
24+
"oryx": {}
25+
}
1126
}
1227
}

test/oryx/test_python_project.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
cd sample-python
9+
10+
# Replicates Oryx's behavior for universal image
11+
DEBIAN_FLAVOR="focal-scm"
12+
mkdir -p /opt/oryx && echo "vso-focal" > /opt/oryx/.imagetype
13+
echo "DEBIAN|${DEBIAN_FLAVOR}" | tr '[a-z]' '[A-Z]' > /opt/oryx/.ostype
14+
15+
ln -snf /usr/local/oryx/* /opt/oryx
16+
17+
PYTHON_PATH="/home/codespace/.python/current"
18+
mkdir -p /home/codespace/.python
19+
ln -snf /usr/local/python/current $PYTHON_PATH
20+
ln -snf /usr/local/python /opt/python
21+
22+
export PATH="/home/codespace/.python/current/bin:${PATH}"
23+
which python
24+
25+
pythonVersion=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)')
26+
pythonSite=`python -m site --user-site`
27+
check "oryx-build-python" oryx build --property python_version="${pythonVersion}" --property packagedir="${pythonSite}" ./
28+
check "oryx-build-python-installed" python3 -m pip list | grep mpmath
29+
check "oryx-build-python-result" python3 ./src/solve.py
30+
31+
# Report result
32+
reportResults

0 commit comments

Comments
 (0)