Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
python-version: '3.13'
architecture: 'x64'

- name: Setup pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-3.12-${{ hashFiles('package.json') }}
key: pip-3.13-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.12-
pip-3.13-
pip-

- name: Get yarn cache directory path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout nglview repository
Expand Down
19 changes: 13 additions & 6 deletions tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unittest
from unittest.mock import MagicMock, patch
from io import StringIO
import sys

import numpy as np
import pytest
Expand Down Expand Up @@ -254,29 +255,35 @@ def update_coords(view=view):
view.frame = 1000
view.frame = 0

p_traj = pt.load(nv.datafiles.TRR, nv.datafiles.PDB)
view.add_trajectory(p_traj)
# FIXME: remove this workaround.
# https://github.com/nglviewer/nglview/pull/1167#issuecomment-3360759056
with_pytraj = sys.version_info < (3, 13)
offset = 0 if with_pytraj else 1

if with_pytraj:
p_traj = pt.load(nv.datafiles.TRR, nv.datafiles.PDB)
view.add_trajectory(p_traj)
m_traj = md.load(nv.datafiles.XTC, top=nv.datafiles.PDB)
view.add_trajectory(m_traj)
# trigger updating coordinates
update_coords()
assert len(view._coordinates_dict.keys()) == 2
assert len(view._coordinates_dict.keys()) == 2 - offset
if has_MDAnalysis:
from MDAnalysis import Universe
mda_traj = Universe(nv.datafiles.PDB, nv.datafiles.TRR)
view.add_trajectory(mda_traj)
update_coords()
assert len(view._coordinates_dict.keys()) == 3
assert len(view._coordinates_dict.keys()) == 3 - offset
if has_HTMD:
from htmd import Molecule
htmd_traj = Molecule(nv.datafiles.PDB)
htmd_traj.filter('protein')
view.add_trajectory(htmd_traj)
update_coords()
if has_MDAnalysis:
assert len(view._coordinates_dict.keys()) == 4
assert len(view._coordinates_dict.keys()) == 4 - offset
else:
assert len(view._coordinates_dict.keys()) == 3
assert len(view._coordinates_dict.keys()) == 3 - offset


def test_API_promise_to_have_add_more_backend():
Expand Down
Loading