Skip to content

Commit

Permalink
Merge pull request #425 from oliverkurth/topic/okurth/fix-python-311
Browse files Browse the repository at this point in the history
fix python test for python >= 3.11
  • Loading branch information
oliverkurth authored May 18, 2023
2 parents 578f343 + c4391d8 commit f906a9f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pytests/tests/test_tdnf_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ def setup_test(utils):
sglpkgname = utils.config['sglversion_pkgname']

global config
config = utils.config['repo_path'] + '/tdnf.conf'
config = os.path.join(utils.config['repo_path'], "tdnf.conf")

if not utils.config.get('installed', False):
path = '{builddir}/python/build/lib.linux-{arch}-{pymajor}.{pyminor}'
# find path to our tdnf python module
builddir = utils.config['build_dir']
arch = os.uname().machine
pymajor = sys.version_info.major
pyminor = sys.version_info.minor

path = path.format(builddir=utils.config['build_dir'],
arch=os.uname().machine,
pymajor=str(sys.version_info.major),
pyminor=str(sys.version_info.minor))
# only support python3
assert pymajor == 3

if pyminor < 11:
path = f"{builddir}/python/build/lib.linux-{arch}-{pymajor}.{pyminor}"
else:
path = f"{builddir}/python/build/lib.linux-{arch}-cpython-{pymajor}{pyminor}"

assert os.path.isdir(path)
sys.path.append(path)

global tdnf
Expand Down

0 comments on commit f906a9f

Please sign in to comment.