-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: tests | ||
|
||
on: | ||
# Run action on certain pull request events | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
# Nightly job on default (main) branch | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
# Ensures that only one workflow runs at a time for this branch | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
pip3 install -e . | ||
pip3 install -r test/test_requirements.txt | ||
- name: Run unit tests | ||
run: test/run_tests.bash | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results | ||
path: test/results/ | ||
# Always publish test results even when there are failures. | ||
if: ${{ always() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
results/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from pyroboplan.core.utils import configuration_distance | ||
|
||
|
||
def test_configuration_distance(): | ||
q_start = np.array([0.0, 0.0, 0.0, 0.0, 0.0]) | ||
q_end = np.array([0.3, 0.0, -0.4, 0.0, 0.0]) | ||
assert configuration_distance(q_start, q_end) == pytest.approx(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Runs all unit tests | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
TEST_RESULTS_DIR="${SCRIPT_DIR}/results" | ||
|
||
echo "Running unit tests..." | ||
python3 -m pytest "$SCRIPT_DIR" \ | ||
--cov="$SCRIPT_DIR" --cov-branch --cov-report term \ | ||
--cov-report html:"$TEST_RESULTS_DIR/test_results_coverage_html" \ | ||
--cov-report xml:"$TEST_RESULTS_DIR/test_results_coverage.xml" \ | ||
--junitxml="$TEST_RESULTS_DIR/test_results.xml" \ | ||
--html="$TEST_RESULTS_DIR/test_results.html" \ | ||
--self-contained-html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pytest | ||
pytest-cov | ||
pytest-dependency | ||
pytest-html |