Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin ASE, fix test #627

Merged
merged 3 commits into from
Feb 6, 2025
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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_requires =
aiida-core>=2.1,<3
aiidalab>=21.11.2
ansi2html~=1.6
ase~=3.18,<3.23
ase~=3.18
bokeh~=2.0
humanfriendly~=10.0
ipytree~=0.2
Expand Down
8 changes: 5 additions & 3 deletions tests/test_viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_folder_data_viewer(folder_data_object):


@pytest.mark.usefixtures("aiida_profile_clean")
def test_structure_data_viewer_storage(structure_data_object):
def test_structure_data_viewer_storage(monkeypatch, tmp_path, structure_data_object):
v = viewers.viewer(structure_data_object)
assert isinstance(v, viewers.StructureDataViewer)

Expand All @@ -88,13 +88,13 @@ def test_structure_data_viewer_storage(structure_data_object):
),
(
"cif",
"""ZGF0YV9pbWFnZTAKX2NoZW1pY2FsX2Zvcm11bGFfc3RydWN0dXJhbCAgICAgICBTaTIKX2NoZW1pY2FsX2Zvcm11bGFfc3VtICAgICAgICAgICAgICAiU2kyIgpfY2VsbF9sZW5ndGhfYSAgICAgICAzLjg0NzM3Cl9jZWxsX2xlbmd0aF9iICAgICAgIDMuODQ3MzcKX2NlbGxfbGVuZ3RoX2MgICAgICAgMy44NDczNwpfY2VsbF9hbmdsZV9hbHBoYSAgICA2MApfY2VsbF9hbmdsZV9iZXRhICAgICA2MApfY2VsbF9hbmdsZV9nYW1tYSAgICA2MAoKX3NwYWNlX2dyb3VwX25hbWVfSC1NX2Fs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hdGlvbl94eXoKICAneCwgeSwgeicKCmxvb3BfCiAgX2F0b21fc2l0ZV90eXBlX3N5bWJvbAogIF9hdG9tX3NpdGVfbGFiZWwKICBfYXRvbV9zaXRlX3N5bW1ldHJ5X211bHRpcGxpY2l0eQogIF9hdG9tX3NpdGVfZnJhY3RfeAogIF9hdG9tX3NpdGVfZnJhY3RfeQogIF9hdG9tX3NpdGVfZnJhY3RfegogIF9hdG9tX3NpdGVfb2NjdXBhbmN5CiAgU2kgIFNpMSAgICAgICAxLjAgIDAuMCAgMC4wICAwLjAgIDEuMDAwMAogIFNpICBTaTIgICAgICAgMS4wICAwLjI1MDAwMDAwMDAwMDAwMDA2ICAwLjI1ICAwLjI1ICAxLjAwMDAK""",
),
]

for fmt, out in format_cases:
v.file_format.label = fmt
assert v._prepare_payload() == out
assert v._prepare_payload() == out, f"{fmt} structure payload does not match"

# Monkey patch the viewer to avoid the need for a running X server.
# fmt: off
Expand All @@ -105,6 +105,8 @@ def test_structure_data_viewer_storage(structure_data_object):
-1.6859999895095825, -1.6859999895095825, -0.6669999957084656, 1,
]
# fmt: on
# Avoid producing temporary files from povray in the repo
monkeypatch.chdir(tmp_path)
Copy link
Contributor Author

@danielhollas danielhollas Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test produces Si2.png and __temp__.pov files so we change the current working directory to a tmp_path. Ultimately this should probably be fixed somewhere in the _render_structure code. I'll do that in a separate PR.

v._render_structure()


Expand Down
Loading