-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct version comparison in
Client.supports_fakeroot
. (#327)
Fixing type error that was caused be comparing wrong types (`mlcube_singularity.singularity_client.Version` with `semver.VersionInfo`).
- Loading branch information
1 parent
c400698
commit c5f1193
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
runners/mlcube_singularity/mlcube_singularity/tests/test_singularity_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from unittest import TestCase | ||
|
||
import semver | ||
from mlcube_singularity.singularity_client import Client, Runtime, Version | ||
|
||
|
||
class TestSingularityRunner(TestCase): | ||
def test___init__(self) -> None: | ||
client = Client( | ||
"sudo singularity", Version(Runtime.APPTAINER, semver.VersionInfo(3, 7, 5)) | ||
) | ||
self.assertListEqual(["sudo", "singularity"], client.singularity) | ||
self.assertEqual(Runtime.APPTAINER, client.version.runtime) | ||
self.assertEqual(3, client.version.version.major) | ||
self.assertEqual(7, client.version.version.minor) | ||
self.assertEqual(5, client.version.version.patch) | ||
|
||
def test_supports_fakeroot(self) -> None: | ||
client = Client( | ||
"sudo singularity", Version(Runtime.APPTAINER, semver.VersionInfo(3, 7, 5)) | ||
) | ||
self.assertTrue(client.supports_fakeroot()) | ||
|
||
client = Client( | ||
"sudo singularity", | ||
Version(Runtime.SINGULARITY, semver.VersionInfo(3, 7, 5)), | ||
) | ||
self.assertTrue(client.supports_fakeroot()) | ||
|
||
client = Client( | ||
"sudo singularity", | ||
Version(Runtime.SINGULARITY, semver.VersionInfo(3, 5, 0)), | ||
) | ||
self.assertTrue(client.supports_fakeroot()) | ||
|
||
client = Client( | ||
"sudo singularity", | ||
Version(Runtime.SINGULARITY, semver.VersionInfo(3, 4, 9)), | ||
) | ||
self.assertFalse(client.supports_fakeroot()) |