Skip to content

Commit

Permalink
Fix tests for Python 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato committed Dec 28, 2023
1 parent ce095ef commit 3dddf74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ rich==13.3.4
rich-click==1.6.1
toml==0.10.2
tomli==2.0.1
typing_extensions==4.5.0
typing_extensions==4.9.0
19 changes: 14 additions & 5 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Any, Dict
from uuid import uuid4

import pkg_resources
import pytest

from config.common import (
Expand All @@ -19,15 +18,25 @@
from config.yaml import YAMLFile


try:
from importlib.resources import files

def _get_file_path(file_name: str) -> str:
return str(files("tests") / file_name)

except ImportError:
# Python 3.8
import pkg_resources

def _get_file_path(file_name: str) -> str:
return pkg_resources.resource_filename(__name__, f"./{file_name}")


class FooSource(ConfigurationSource):
def get_values(self) -> Dict[str, Any]:
return {}


def _get_file_path(file_name: str) -> str:
return pkg_resources.resource_filename(__name__, f"./{file_name}")


def test_builder():
builder = ConfigurationBuilder()

Expand Down

0 comments on commit 3dddf74

Please sign in to comment.