diff --git a/code/tests.toml b/code/tests.toml index f29782d..9fcea38 100644 --- a/code/tests.toml +++ b/code/tests.toml @@ -132,6 +132,7 @@ setup_packages = [ { path = "ws_client", run = false } ] setup_scripts = [ + { path = "ws_client/requirements.sh", args = "" }, { path = "ws_client/ws_server.py", args = "" } ] test_package_paths = ["ws_client/test/ws_client_test"] @@ -151,7 +152,9 @@ dependency_package_paths = [] setup_packages = [ { path = "ws_server", run = true } ] -setup_scripts = [] +setup_scripts = [ + { path = "ws_server/requirements.sh", args = "" } +] test_package_paths = [] test_scripts = [{ path = "ws_server/ws_client.py", args = "" }] timeout_secs = 5 @@ -169,7 +172,9 @@ dependency_package_paths = [] setup_packages = [ { path = "ws_server_with_reply", run = true } ] -setup_scripts = [] +setup_scripts = [ + { path = "ws_server/requirements.sh", args = "" } +] test_package_paths = [] test_scripts = [{ path = "ws_server_with_reply/ws_client.py", args = "" }] timeout_secs = 5 diff --git a/code/ws_client/requirements.sh b/code/ws_client/requirements.sh new file mode 100755 index 0000000..b2adcc4 --- /dev/null +++ b/code/ws_client/requirements.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check if pip is installed and install it if it is not. +if ! command -v pip &> /dev/null +then + echo "pip could not be found, installing..." + python -m ensurepip --upgrade +fi + +# Update pip to the latest version. +python -m pip install --upgrade pip + +# Install packages from the requirements.txt file. +if [ -f "requirements.txt" ]; then + echo "Installing packages from requirements.txt..." + pip install -r requirements.txt +else + echo "Error: requirements.txt does not exist." + exit 0 +fi + +echo "Package installation complete." diff --git a/code/ws_client/test/tests.toml b/code/ws_client/test/tests.toml index e0f97aa..ae65d1e 100644 --- a/code/ws_client/test/tests.toml +++ b/code/ws_client/test/tests.toml @@ -10,6 +10,7 @@ setup_packages = [ { path = "..", run = false } ] setup_scripts = [ + { path = "ws_server/requirements.sh", args = "" }, { path = "../ws_server.py", args = "" } ] test_package_paths = ["ws_client_test"] diff --git a/code/ws_server/requirements.sh b/code/ws_server/requirements.sh new file mode 100755 index 0000000..b2adcc4 --- /dev/null +++ b/code/ws_server/requirements.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check if pip is installed and install it if it is not. +if ! command -v pip &> /dev/null +then + echo "pip could not be found, installing..." + python -m ensurepip --upgrade +fi + +# Update pip to the latest version. +python -m pip install --upgrade pip + +# Install packages from the requirements.txt file. +if [ -f "requirements.txt" ]; then + echo "Installing packages from requirements.txt..." + pip install -r requirements.txt +else + echo "Error: requirements.txt does not exist." + exit 0 +fi + +echo "Package installation complete." diff --git a/code/ws_server/test/tests.toml b/code/ws_server/test/tests.toml index 307f154..d48d61e 100644 --- a/code/ws_server/test/tests.toml +++ b/code/ws_server/test/tests.toml @@ -9,7 +9,9 @@ dependency_package_paths = [] setup_packages = [ { path = "..", run = true } ] -setup_scripts = [] +setup_scripts = [ + { path = "ws_server/requirements.sh", args = "" } +] test_package_paths = [] test_scripts = [{ path = "../ws_client.py", args = "" }] timeout_secs = 5 diff --git a/code/ws_server_with_reply/requirements.sh b/code/ws_server_with_reply/requirements.sh new file mode 100755 index 0000000..b2adcc4 --- /dev/null +++ b/code/ws_server_with_reply/requirements.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check if pip is installed and install it if it is not. +if ! command -v pip &> /dev/null +then + echo "pip could not be found, installing..." + python -m ensurepip --upgrade +fi + +# Update pip to the latest version. +python -m pip install --upgrade pip + +# Install packages from the requirements.txt file. +if [ -f "requirements.txt" ]; then + echo "Installing packages from requirements.txt..." + pip install -r requirements.txt +else + echo "Error: requirements.txt does not exist." + exit 0 +fi + +echo "Package installation complete." diff --git a/code/ws_server_with_reply/test/tests.toml b/code/ws_server_with_reply/test/tests.toml index 307f154..d48d61e 100644 --- a/code/ws_server_with_reply/test/tests.toml +++ b/code/ws_server_with_reply/test/tests.toml @@ -9,7 +9,9 @@ dependency_package_paths = [] setup_packages = [ { path = "..", run = true } ] -setup_scripts = [] +setup_scripts = [ + { path = "ws_server/requirements.sh", args = "" } +] test_package_paths = [] test_scripts = [{ path = "../ws_client.py", args = "" }] timeout_secs = 5