Skip to content

Commit

Permalink
basic unit test for local tests to assist avery
Browse files Browse the repository at this point in the history
  • Loading branch information
ilaflott committed Nov 14, 2024
1 parent fe5fc2c commit f0826b3
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fre/tests/test_fre_pp_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
''' test "fre pp" calls '''

import os
import shutil
from pathlib import Path
import subprocess

import pytest

from click.testing import CliRunner

from fre import fre
Expand Down Expand Up @@ -39,6 +46,29 @@ def test_cli_fre_pp_checkout_opt_dne():
result = runner.invoke(fre.fre, args=["pp", "checkout", "optionDNE"])
assert result.exit_code == 2

@pytest.mark.skip(reason='CI/CD fails bc it hates it when code pulls in other code, ot the best of ians knowledge') #TODO
def test_cli_fre_pp_checkout_case_1():
''' fre pp checkout '''
clone_dir = os.path.expanduser("~/cylc-src")+'/exp__plat__target_test9'
if Path(clone_dir).exists():
shutil.rmtree(clone_dir)
result = runner.invoke(fre.fre,
args = ["pp", "checkout", "-e", "exp", "-p", "plat", "-t", "target_test9"],
catch_exceptions = True )
assert all( [ result.exit_code == 0,
Path(clone_dir).exists() ] )

curr_dir=os.getcwd()
os.chdir(clone_dir)
#subprocess.run( ["git", "checkout", "-b", "2024.01" ] ) #sanity check to make sure the condition you want below works
git_branch_out=subprocess.run(
["git", "branch"],
capture_output = True ).stdout.decode().split('\n')
os.chdir(curr_dir)
#assert '* main' in git_branch_out # sanity check to make sure the condition you want below works
assert '* 2024.01' in git_branch_out


#-- fre pp configure-xml
def test_cli_fre_pp_configure_xml():
''' fre pp configure-xml '''
Expand Down

0 comments on commit f0826b3

Please sign in to comment.