Skip to content

Commit

Permalink
Update test_cli.test_dl() to use __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Jun 7, 2020
1 parent 6c75f04 commit 6010085
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion message_ix/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
import re

import pytest

Expand Down Expand Up @@ -45,4 +46,11 @@ def test_dl(message_ix_cli, opts, tmp_path):
print(r.exception, r.output)

if opts == "":
assert "Default: latest release v2.0.0" in r.output
# Guess what the latest release will be from GitHub, using __version__.
# This string is provided by setuptools-scm based on the most recent
# Git tag, e.g. if the tag is 'v3.0.0' it may be '3.0.1.devN+etc'.
major = message_ix.__version__.split('.')[0]

# 'message-ix dl' defaults to the latest release
pattern = re.compile(fr"Default: latest release v{major}\.\d+\.\d+")
assert pattern.match(r.output)

0 comments on commit 6010085

Please sign in to comment.