diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-11-17 22:55:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 22:55:43 +0300 |
commit | 3fc9604ddadc34ec44651ce981cebc7bd77095e5 (patch) | |
tree | 46f1603423215c57744c7165d71fd78d53afd888 /test/oryx | |
parent | be4f0498e4ad7948804d4be70093c1da8722d222 (diff) |
Oryx: Build with .NET 6 (#298)
* Oryx: Install dotnet 3.1 runtime
* fix tests
* build with .NET 6 + add tests
* add tests
* fix tests
* shellcheck: nit
Diffstat (limited to 'test/oryx')
-rw-r--r-- | test/oryx/sample-python/requirements.txt | 2 | ||||
-rw-r--r-- | test/oryx/sample-python/src/solve.py | 12 | ||||
-rw-r--r-- | test/oryx/scenarios.json | 15 | ||||
-rw-r--r-- | test/oryx/test_python_project.sh | 32 |
4 files changed, 61 insertions, 0 deletions
diff --git a/test/oryx/sample-python/requirements.txt b/test/oryx/sample-python/requirements.txt new file mode 100644 index 0000000..c8a04f6 --- /dev/null +++ b/test/oryx/sample-python/requirements.txt @@ -0,0 +1,2 @@ +mpmath==1.2.1 +sympy==1.11.1 diff --git a/test/oryx/sample-python/src/solve.py b/test/oryx/sample-python/src/solve.py new file mode 100644 index 0000000..141a996 --- /dev/null +++ b/test/oryx/sample-python/src/solve.py @@ -0,0 +1,12 @@ +from sympy import Symbol, Eq, solve + +x = Symbol("x") +y = Symbol("y") + +equation_1 = Eq((x + y), 2) +equation_2 = Eq((x - y), 4) +print("Equation 1:", equation_1) +print("Equation 2:", equation_2) + +solution = solve((equation_1, equation_2), (x, y)) +print("Solution:", solution) diff --git a/test/oryx/scenarios.json b/test/oryx/scenarios.json index 4b9fa90..bbfc277 100644 --- a/test/oryx/scenarios.json +++ b/test/oryx/scenarios.json @@ -8,5 +8,20 @@ }, "oryx": {} } + }, + "test_python_project": { + "image": "ubuntu:focal", + "features": { + "python": { + "version": "3.10.4", + "additionalVersions": "3.9.7", + "useOryxIfAvailable": "false" + }, + "dotnet": { + "version": "7", + "installUsingApt": "false" + }, + "oryx": {} + } } }
\ No newline at end of file diff --git a/test/oryx/test_python_project.sh b/test/oryx/test_python_project.sh new file mode 100644 index 0000000..a0d5eef --- /dev/null +++ b/test/oryx/test_python_project.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +cd sample-python + +# Replicates Oryx's behavior for universal image +DEBIAN_FLAVOR="focal-scm" +mkdir -p /opt/oryx && echo "vso-focal" > /opt/oryx/.imagetype +echo "DEBIAN|${DEBIAN_FLAVOR}" | tr '[a-z]' '[A-Z]' > /opt/oryx/.ostype + +ln -snf /usr/local/oryx/* /opt/oryx + +PYTHON_PATH="/home/codespace/.python/current" +mkdir -p /home/codespace/.python +ln -snf /usr/local/python/current $PYTHON_PATH +ln -snf /usr/local/python /opt/python + +export PATH="/home/codespace/.python/current/bin:${PATH}" +which python + +pythonVersion=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)') +pythonSite=`python -m site --user-site` +check "oryx-build-python" oryx build --property python_version="${pythonVersion}" --property packagedir="${pythonSite}" ./ +check "oryx-build-python-installed" python3 -m pip list | grep mpmath +check "oryx-build-python-result" python3 ./src/solve.py + +# Report result +reportResults |