-
Notifications
You must be signed in to change notification settings - Fork 15
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
FIX: Invert default schema URLs #971
Conversation
1751d3e
to
762e5ac
Compare
5b21277
to
ad968ea
Compare
0a3a6f0
to
c939dc6
Compare
if [[ "${{ github.event.pull_request.base.ref }}" == "staging" ]]; then | ||
pytest -n auto -v --cov --cov-report term-missing --prod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both pytest and update-schemas take a --prod
flag now. Both ensure the DEV_SCHEMAS
environment variable is unset. This causes the default case to happen: schemas and metadata are produced with the production url.
"pytest", | ||
"pytest-xdist", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort + not sure why this dependency was never added to parallelize tests
if os.environ.get("DEV_SCHEMA", False): | ||
return DEV_URL | ||
return PROD_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't be able to produce metadata with the $schema = radix dev
in Komodo bleeding without exploring some other option. I guess this is OK but not ideal. Could check for KOMODO_BLEEDING explicitly, but I don't really like that
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--prod", action="store_true", help="Use schemas/metadata with production URLs." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes pytest aware of our custom pytest --prod
command, configured below. But also set at the top of this file because pytest, and some tests, do funky things with environment variables. Since the models in dataio look for this environment variable it is safest to ensure it's set before they are imported, but are still set by the pytest config anyway
# Ensures URLs will differ based on above | ||
import fmu.dataio._models as models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazy import to ensure the models receive the DEV_SCHEMA
env var we want them to
c939dc6
to
1f119f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I like the new 🚨
Resolves #968