Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Feb 9, 2025
1 parent 04f75ba commit 44a978e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unittests/resources/config/bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systems:
launcher: local
environs: ['builtin']
extras:
getenv: {{ getenv("USER") }}
getenv: {{ getenv("_FOO_") }}
gid: {{ gid }}
group: {{ group }}
hostname: {{ hostname }}
Expand Down
5 changes: 3 additions & 2 deletions unittests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,19 @@ def test_system_create(site_config):
assert system.partitions[0].container_runtime == 'Docker'


def test_yaml_bindings():
def test_yaml_bindings(monkeypatch):
import os
import socket
import reframe.utility.osext as osext

monkeypatch.setenv('_FOO_', 'bar')
site_config = config.load_config(
'unittests/resources/config/bindings.yaml'
)
site_config.select_subconfig('testsys:default')
system = System.create(site_config)
extras = system.partitions[0].extras
assert extras['getenv'] == os.getenv('USER')
assert extras['getenv'] == os.getenv('_FOO_')
assert extras['gid'] == os.getgid()
assert extras['group'] == osext.osgroup()
assert extras['hostname'] == socket.gethostname()
Expand Down

0 comments on commit 44a978e

Please sign in to comment.