Skip to content

Commit

Permalink
feat: added property to return rhc version
Browse files Browse the repository at this point in the history
Signed-off-by: Archana Pandey <[email protected]>
  • Loading branch information
archana-redhat authored and ptoscano committed Aug 6, 2024
1 parent 4b977b4 commit af5bafa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pytest_client_tools/rhc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

import json
import pathlib
import re
import subprocess

from .util import SavedFile, logged_run
from .util import SavedFile, logged_run, Version


RHC_FILES_TO_SAVE = (
Expand Down Expand Up @@ -36,6 +37,20 @@ def is_registered(self):
doc = json.loads(proc.stdout)
return doc["rhsm_connected"]

@property
def version(self):
"""
Return the version of rhc as
[`Version`][pytest_client_tools.util.Version] object.
:return: The version of the rhc in use.
:rtype: pytest_client_tools.util.Version
"""
proc = self.run("--version")
m = re.search(r"^rhc version (.+)$", proc.stdout, re.MULTILINE)
assert m
return Version(m.group(1))

def run(self, *args, check=True, text=True):
"""
Run `rhc` with the specified arguments.
Expand Down

0 comments on commit af5bafa

Please sign in to comment.