File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ _green="\033[32m"
55_yellow=" \033[01;33m"
66_red=" \033[31m"
77
8+ # Version number has to follow pattern "^v\d+\.\d+\.\d+.*$"
89_version=" v1.0.1"
910
1011venv::_version () {
Original file line number Diff line number Diff line change 11import re
2- from pathlib import Path
32
43import pytest
54
65from tests .helpers import run_command
76
7+ _version_pattern = re .compile (r"^venv-cli v\d+\.\d+\.\d+.*$" )
8+
89
910@pytest .mark .parametrize ("arg" , ["-V" , "--version" ])
10- def test_venv_help (arg : str , tmp_path : Path , capfd : pytest .CaptureFixture ):
11- """Checks that we can show the version number"""
12- run_command (f"venv { arg } " , cwd = tmp_path )
11+ def test_venv_version (arg : str , capfd : pytest .CaptureFixture ):
12+ """Checks that we can show the version number, and that the version number
13+ complies with the required pattern"""
14+ run_command (f"venv { arg } " )
1315
14- captured = capfd .readouterr ()
15- assert re .search ( r"venv-cli\s\d+?\.\d+?\.\d+?" , captured . out )
16+ output = capfd .readouterr (). out
17+ assert re .match ( _version_pattern , output . strip () )
You can’t perform that action at this time.
0 commit comments