Skip to content

Commit 38ee5bc

Browse files
author
Samuel FORESTIER
committed
Fixes test cases according to OSError being now caught (see 4aa21c9)
1 parent 76fb2e2 commit 38ee5bc

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

tests/test_distro.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import ast
16-
import errno
1716
import io
1817
import json
1918
import os
@@ -732,8 +731,8 @@ def test_rootdirescape(self) -> None:
732731
self.distro = distro.LinuxDistribution(
733732
root_dir=os.path.join(TESTDISTROS, "distro", "rootdirescape")
734733
)
735-
with pytest.raises(FileNotFoundError, match=r"resolves outside"):
736-
self.distro.id()
734+
# loading existing file outside of root_dir has been prevented (empty data)
735+
self._test_outcome({})
737736

738737
def test_rootdirnonescape(self) -> None:
739738
self.distro = distro.LinuxDistribution(
@@ -746,9 +745,8 @@ def test_symlinksloop(self) -> None:
746745
self.distro = distro.LinuxDistribution(
747746
root_dir=os.path.join(TESTDISTROS, "distro", "symlinksloop")
748747
)
749-
with pytest.raises(OSError) as excinfo:
750-
self.distro.id()
751-
assert excinfo.value.errno == errno.ELOOP
748+
# due to symbolic links loop, loading of file has been prevented (empty data)
749+
self._test_outcome({})
752750

753751
def test_dontincludeuname(self) -> None:
754752
self._setup_for_distro(os.path.join(TESTDISTROS, "distro", "dontincludeuname"))

0 commit comments

Comments
 (0)