Skip to content

Commit

Permalink
Add FLEPI_PATH to GH action, fix Jinja2 loader
Browse files Browse the repository at this point in the history
* Export `$FLEPI_PATH` in the GH action before running tests to run the
  unit tests for `get_cluster_info`.
* Attempt to fix Jinja2 lader issue by falling back to a file system
  loader if a package loader fails.
  • Loading branch information
TimothyWillard committed Nov 26, 2024
1 parent d549728 commit 02d550e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gempyor-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
shell: bash
- name: Run gempyor tests
run: |
export FLEPI_PATH=$(pwd)
cd flepimop/gempyor_pkg
pytest --exitfirst
shell: bash
Expand Down
11 changes: 9 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/_jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
from tempfile import mkstemp
from typing import Any

from jinja2 import Environment, PackageLoader, Template
from jinja2 import Environment, FileSystemLoader, PackageLoader, Template


# Globals
_jinja_environment = Environment(loader=PackageLoader("gempyor", "templates"))
try:
_jinja_environment = Environment(loader=PackageLoader("gempyor", "templates"))
except ValueError:
from os.path import dirname

_jinja_environment = Environment(
loader=FileSystemLoader(dirname(__file__) + "/templates")
)


# Functions
Expand Down

0 comments on commit 02d550e

Please sign in to comment.