Skip to content

Commit

Permalink
Avoid deprecated importlib API; fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Will Killian <[email protected]>
  • Loading branch information
willkill07 committed Mar 6, 2025
1 parent c884848 commit 0bb5101
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
15 changes: 12 additions & 3 deletions ci/conda/recipes/morpheus-libs/morpheus_core_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ if [[ $(arch) == "aarch64" ]]; then
exit 0
fi

package_name="morpheus"
file_name="requirements_morpheus_core_arch-$(arch).txt"

# Install requirements if they are included in the package
python3 <<EOF
import importlib.resources
import subprocess
with importlib.resources.path("morpheus", "requirements_morpheus_core_arch-$(arch).txt") as requirements_file:
import sys
import importlib.resources as ir
package_name = "${package_name}"
file_name = "${file_name}"
with ir.as_file(ir.files(anchor=package_name).joinpath(file_name)) as requirements_file:
subprocess.call(f"pip install -r {requirements_file}".split())
EOF

pytest tests/morpheus
pytest tests/${package_name}
15 changes: 12 additions & 3 deletions ci/conda/recipes/morpheus-libs/morpheus_dfp_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ if [[ $(arch) == "aarch64" ]]; then
exit 0
fi

package_name="morpheus_dfp"
file_name="requirements_morpheus_dfp_arch-$(arch).txt"

# Install requirements if they are included in the package
python3 <<EOF
import importlib.resources
import subprocess
with importlib.resources.path("morpheus_dfp", "requirements_morpheus_dfp_arch-$(arch).txt") as requirements_file:
import sys
import importlib.resources as ir
package_name = "${package_name}"
file_name = "${file_name}"
with ir.as_file(ir.files(anchor=package_name).joinpath(file_name)) as requirements_file:
subprocess.call(f"pip install -r {requirements_file}".split())
EOF

pytest tests/morpheus_dfp
pytest tests/${package_name}
14 changes: 11 additions & 3 deletions ci/conda/recipes/morpheus-libs/morpheus_llm_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ if [[ $(arch) == "aarch64" ]]; then
exit 0
fi

package_name="morpheus_llm"
file_name="requirements_morpheus_llm_arch-$(arch).txt"

# Install requirements if they are included in the package
python3 <<EOF
import importlib.resources
import subprocess
with importlib.resources.path("morpheus_llm", "requirements_morpheus_llm_arch-$(arch).txt") as requirements_file:
import sys
import importlib.resources as ir
package_name = "${package_name}"
file_name = "${file_name}"
with ir.as_file(ir.files(anchor=package_name).joinpath(file_name)) as requirements_file:
subprocess.call(f"pip install -r {requirements_file}".split())
EOF

pytest tests/morpheus_llm
pytest tests/${package_name}
2 changes: 1 addition & 1 deletion tests/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def import_or_skip(modname: str,
raise ImportError(e) from e
raise
except Exception as e:
# if we encounter some expcetion while loading, then also skip the test
# if we encounter some exception while loading, then also skip the test
if fail_missing:
raise e
raise pytest.skip.Exception(f"failed to import {modname}: {e}")
Expand Down

0 comments on commit 0bb5101

Please sign in to comment.