Skip to content

Commit

Permalink
f-s
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Aug 8, 2023
1 parent 07c5983 commit 58b0bfa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
9 changes: 3 additions & 6 deletions tests/test_bug_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
import json
import zlib

from aiidalab_widgets_base.bug_report import (
get_environment_fingerprint,
parse_environment_fingerprint,
)
from aiidalab_widgets_base import bug_report


def test_fingerprint_parser():
"""Test get_environment_fingerprint function and parse it out."""

encoding = "utf-8"
fingerprint = get_environment_fingerprint(encoding)
fingerprint = bug_report.get_environment_fingerprint(encoding)

# Parse the fingerprint.
data = parse_environment_fingerprint(fingerprint)
data = bug_report.parse_environment_fingerprint(fingerprint)

# To test, manually generate the fingerprint and compare it to the output of the parser.
json_data = json.dumps(data, separators=(",", ":"))
Expand Down
19 changes: 8 additions & 11 deletions tests/test_computational_resources.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import pytest
from aiida import orm

import aiidalab_widgets_base as awb
from aiidalab_widgets_base.computational_resources import (
AiidaCodeSetup,
AiidaComputerSetup,
SshComputerSetup,
)
from aiidalab_widgets_base import computational_resources


@pytest.mark.usefixtures("aiida_profile_clean")
def test_computaional_resources_widget(aiida_local_code_bash):
"""Test the ComputationalResourcesWidget."""
widget = awb.ComputationalResourcesWidget(default_calc_job_plugin="bash")
widget = computational_resources.ComputationalResourcesWidget(
default_calc_job_plugin="bash"
)

# Get the list of currently installed codes.
codes_dict = widget._get_codes()
Expand All @@ -22,7 +19,7 @@ def test_computaional_resources_widget(aiida_local_code_bash):
@pytest.mark.usefixtures("aiida_profile_clean")
def test_ssh_computer_setup_widget():
"""Test the SshComputerSetup."""
widget = SshComputerSetup()
widget = computational_resources.SshComputerSetup()

ssh_config = {
"hostname": "daint.cscs.ch",
Expand Down Expand Up @@ -67,7 +64,7 @@ def test_ssh_computer_setup_widget():
@pytest.mark.usefixtures("aiida_profile_clean")
def test_aiida_computer_setup_widget():
"""Test the AiidaComputerSetup."""
widget = AiidaComputerSetup()
widget = computational_resources.AiidaComputerSetup()

# At the beginning, the computer_name should be an empty string.
assert widget.label.value == ""
Expand Down Expand Up @@ -118,7 +115,7 @@ def test_aiida_computer_setup_widget():
@pytest.mark.usefixtures("aiida_profile_clean")
def test_aiida_code_setup(aiida_localhost):
"""Test the AiidaCodeSetup."""
widget = AiidaCodeSetup()
widget = computational_resources.AiidaCodeSetup()

# At the beginning, the code_name should be an empty string.
assert widget.label.value == ""
Expand Down Expand Up @@ -160,7 +157,7 @@ def test_aiida_code_setup(aiida_localhost):
@pytest.mark.usefixtures("aiida_profile_clean")
def test_computer_dropdown_widget(aiida_localhost):
"""Test the ComputerDropdownWidget."""
widget = awb.ComputerDropdownWidget()
widget = computational_resources.ComputerDropdownWidget()

assert "localhost" in widget.computers

Expand Down

0 comments on commit 58b0bfa

Please sign in to comment.