Skip to content

Commit

Permalink
Use importlib to get version of pangeo-forge-recipes
Browse files Browse the repository at this point in the history
Let's not parse output of pip list.
  • Loading branch information
yuvipanda committed Aug 19, 2023
1 parent dc17acd commit 26eb9a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import socket
import subprocess
import tempfile
from importlib.metadata import version

import pytest

Expand Down Expand Up @@ -63,10 +64,7 @@ def minio(local_ip):
def recipes_version_ref():
# FIXME: recipes version matrix is currently determined by github workflows matrix
# in the future, it should be set by pangeo-forge-runner venv feature?
pip_list = subprocess.check_output("pip list".split()).decode("utf-8").splitlines()
recipes_version = [
p.split()[-1] for p in pip_list if p.startswith("pangeo-forge-recipes")
][0]
recipes_version = version("pangeo-forge-recipes")
# the recipes_version is a 3-element semantic version of form `0.A.B` where A is either minor
# version `9` or `10`. the test feedstock (pforgetest/gpcp-from-gcs-feedstock) has tags for
# each of these minor versions, of the format `0.A.x`, so we translate the installed version
Expand Down

0 comments on commit 26eb9a1

Please sign in to comment.