Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Yelp/swagger_spec_validator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a306a6c6dfc1520b41d3c873d9b7597249f87501
Choose a base ref
..
head repository: Yelp/swagger_spec_validator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 07b76f2d022878cd8d212c90b060d52f4895a7ba
Choose a head ref
Showing with 4 additions and 5 deletions.
  1. +2 −1 swagger_spec_validator/common.py
  2. +2 −4 tests/common_test.py
3 changes: 2 additions & 1 deletion swagger_spec_validator/common.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
from urllib.request import urlopen

import yaml

try:
from importlib.resources import files # type: ignore
from importlib.resources import as_file # type: ignore
@@ -62,7 +63,7 @@ def read_file(file_path: str) -> dict[str, Any]:

@lru_cache()
def read_resource_file(resource_path: str) -> tuple[dict[str, Any], str]:
ref = files('swagger_spec_validator') / resource_path
ref = files("swagger_spec_validator") / resource_path
with as_file(ref) as path:
return read_file(path), path

6 changes: 2 additions & 4 deletions tests/common_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import importlib.resources
import uuid
from unittest import mock

import importlib.resources
try:
from importlib.resources import files # ignore: type
except ImportError: # pragma: cover
@@ -22,6 +22,4 @@ def test_read_resource_file(monkeypatch):
read_resource_file(resource_path)
read_resource_file(resource_path)

m.assert_called_once_with(
files("swagger_spec_validator") / resource_path
)
m.assert_called_once_with(files("swagger_spec_validator") / resource_path)