Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hooks: Fix googleapiclient.model missing docs and improve test #596

Merged
merged 1 commit into from Jun 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions news/596.update.rst
@@ -0,0 +1 @@
Update hook for ``googleapiclient.model``, fixing missing discovery docs and improving test.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Expand Up @@ -33,6 +33,7 @@ fiona==1.9.4.post1; sys_platform != 'win32'
folium==0.14.0
ffpyplayer==4.5.0
geopandas==0.13.1; python_version >= '3.8' and sys_platform != 'win32'
google-api-python-client==2.88.0; python_version >= '3.7'
graphql-query==1.1.1
python-gitlab==3.14.0
h5py==3.8.0; python_version >= '3.7'
Expand Down
Expand Up @@ -17,4 +17,4 @@
# pkg_resources.get_distribution("google-api-python-client").version,
# so we need to collect that package's metadata
datas = copy_metadata('google_api_python_client')
datas += collect_data_files('googleapiclient.discovery', excludes=['*.txt', '**/__pycache__'])
datas += collect_data_files('googleapiclient.discovery_cache', excludes=['*.txt', '**/__pycache__'])
15 changes: 13 additions & 2 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Expand Up @@ -605,10 +605,21 @@ def test_torchvision_nms(pyi_builder):
""")


@importorskip('googleapiclient')
@requires('google-api-python-client >= 2.0.0')
def test_googleapiclient(pyi_builder):
pyi_builder.test_source("""
from googleapiclient.discovery import build
from googleapiclient import discovery, discovery_cache

API_NAME = "youtube"
API_VERSION = "v3"

for file in os.listdir(discovery_cache.DISCOVERY_DOC_DIR): # Always up to date
if file.startswith("youtube.v") and file.endswith(".json"):
API_NAME, API_VERSION = file.split(".")[:2]
break

# developerKey can be any non-empty string
yt = discovery.build(API_NAME, API_VERSION, developerKey=":)", static_discovery=True)
""")


Expand Down