diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index d4fdb19..2499815 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -1,19 +1,22 @@ name: CI on: - # GitHub has started calling new repo's first branch "main" https://github.com/github/renaming - # The cookiecutter uses the "--initial-branch" flag when it runs git-init + # GitHub has started calling the new repo's first branch "main" https://github.com/github/renaming + # Existing codes likely still have "master" as the primary branch + # Both are tracked here to keep legacy and new codes working push: branches: + - "master" - "main" pull_request: branches: + - "master" - "main" schedule: - # Weekly tests run on main by default: + # Nightly tests run on master by default: # Scheduled workflows run on the latest commit on the default or base branch. # (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) - - cron: "0 0 * * 0" + - cron: "0 0 * * *" jobs: test: @@ -22,10 +25,10 @@ jobs: strategy: matrix: os: [macOS-latest, ubuntu-latest, windows-latest] - python-version: [3.8, 3.9, "3.10"] + python-version: [3.9, 3.10, 3.11] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Additional info about the build shell: bash @@ -35,7 +38,7 @@ jobs: ulimit -a # More info on options: https://github.com/marketplace/actions/provision-with-micromamba - - uses: mamba-org/provision-with-micromamba@main + - uses: mamba-org/setup-micromamba@v1 with: environment-file: devtools/conda-envs/test_env.yaml environment-name: test diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index c79a37b..d68e80d 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -1,20 +1,21 @@ name: test channels: - - - conda-forge - - - defaults + - conda-forge + - defaults dependencies: - # Base depends - - python - - pip + # Base depends + - python + - pip - # Testing - - pytest - - pytest-cov - - codecov + # Package dependencies + - numpy + - matplotlib - # Pip-only installs - #- pip: - # - codecov + # Testing + - pytest + - pytest-cov + - codecov + # Pip-only installs + #- pip: + # - codecov \ No newline at end of file diff --git a/molecool/tests/test_measure.py b/molecool/tests/test_measure.py index a3b4b0e..b506cb5 100644 --- a/molecool/tests/test_measure.py +++ b/molecool/tests/test_measure.py @@ -42,4 +42,16 @@ def test_calculate_angle_many(p1, p2, p3, expected_angle): calculated_angle = molecool.calculate_angle(p1, p2, p3, degrees=True) - assert expected_angle == pytest.approx(calculated_angle), F'{calculated_angle} {expected_angle}' \ No newline at end of file + assert expected_angle == pytest.approx(calculated_angle), F'{calculated_angle} {expected_angle}' + +def test_calculate_angle_radians(): + """Test the calculate_angle function with output in radians""" + + r1 = np.array([1, 0, 0]) + r2 = np.array([0, 0, 0]) + r3 = np.array([0, 1, 0]) + + expected_value = 90 * (np.pi / 180) + + calculated_value = molecool.calculate_angle(r1, r2, r3) + assert expected_value == calculated_value \ No newline at end of file