Skip to content
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
5 changes: 2 additions & 3 deletions scripts/container-pre-test.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/bash

source /etc/os-release
# This repository is required for python3-pytest and python3-test
# on Centos Stream
# This repository is required for python3-pytest on Centos Stream
if [[ $ID == "centos" ]]; then
dnf config-manager --enable crb
fi

dnf install -y python3-setuptools python3-pip python3-devel python3-pytest python3-test
dnf install -y python3-setuptools python3-pip python3-devel python3-pytest
14 changes: 9 additions & 5 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"""

import os
import shutil
import tempfile
from iniparse import compat as ConfigParser
from io import StringIO
try:
Expand All @@ -18,8 +20,6 @@
import collections as UserDict
import unittest

from test import support as test_support


class SortedDict(UserDict.UserDict):
def items(self):
Expand Down Expand Up @@ -466,9 +466,13 @@ def test_read_returns_file_list(self):
3. Empty list is returned due to file not existing.
4. Empty list is returned since no files were passed.
"""
file1 = test_support.findfile("cfgparser.1")
if not os.path.exists(file1):
file1 = test_support.findfile("configdata/cfgparser.1")
# Do not depend on the data files of CPython's 'test' package,
# which is not installed on many systems.
tmpdir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpdir)
file1 = os.path.join(tmpdir, "cfgparser.1")
with open(file1, "w") as f:
f.write("[Foo Bar]\nfoo=newbar\n")
# check when we pass a mix of readable and non-readable files:
cf = self.newconfig()
parsed_files = cf.read([file1, "nonexistant-file"])
Expand Down
Loading