From 7424e00fb309e4eca59b0153a67f5f1a50d0bc87 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Nov 16 2022 07:00:01 +0000 Subject: Fix compatibility with pytest 7.2 --- diff --git a/docker-compose.spec b/docker-compose.spec index fbc826b..e3767b0 100644 --- a/docker-compose.spec +++ b/docker-compose.spec @@ -1,12 +1,14 @@ Name: docker-compose Version: 1.29.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Multi-container orchestration for Docker License: ASL 2.0 URL: https://github.com/docker/compose Source0: %pypi_source BuildArch: noarch +Patch: pytest-7.2-compatibility.patch + BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-pytest @@ -106,6 +108,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version} --verbose te %changelog +* Wed Nov 16 2022 Lumír Balhar - 1.29.2-7 +- Fix compatibility with pytest 7.2 + * Thu Jul 21 2022 Fedora Release Engineering - 1.29.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/pytest-7.2-compatibility.patch b/pytest-7.2-compatibility.patch new file mode 100644 index 0000000..1139f75 --- /dev/null +++ b/pytest-7.2-compatibility.patch @@ -0,0 +1,53 @@ +From a277e6101828afa58b4b602c4e402259889de81b Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Wed, 16 Nov 2022 07:45:03 +0100 +Subject: [PATCH] pytest 7.2 compatibility + +--- + tests/unit/cli_test.py | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/tests/unit/cli_test.py b/tests/unit/cli_test.py +index fa6e767..3d766e8 100644 +--- a/tests/unit/cli_test.py ++++ b/tests/unit/cli_test.py +@@ -1,10 +1,11 @@ ++import contextlib + import os + import shutil + import tempfile + from io import StringIO ++from pathlib import Path + + import docker +-import py + import pytest + from docker.constants import DEFAULT_DOCKER_API_VERSION + +@@ -23,11 +24,21 @@ from compose.container import Container + from compose.project import Project + + ++@contextlib.contextmanager ++def working_directory(path): ++ cwd = Path.cwd() ++ os.chdir(path) ++ try: ++ yield ++ finally: ++ os.chdir(cwd) ++ ++ + class CLITestCase(unittest.TestCase): + + def test_default_project_name(self): +- test_dir = py._path.local.LocalPath('tests/fixtures/simple-composefile') +- with test_dir.as_cwd(): ++ test_dir = Path('tests/fixtures/simple-composefile') ++ with working_directory(test_dir): + project_name = get_project_name('.') + assert 'simple-composefile' == project_name + +-- +2.38.1 +