Skip to content

Commit

Permalink
Revert overzelous privitisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewHambley committed Apr 4, 2024
1 parent ef209ce commit 5677b42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/fab/steps/grab/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from fab.tools import run_command


def __current_commit(folder=None):
def current_commit(folder=None):
folder = folder or '.'
output = run_command(['git', 'log', '--oneline', '-n', '1'], cwd=folder)
commit = output.split()[0]
Expand Down
10 changes: 5 additions & 5 deletions tests/system_tests/git/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import pytest

from fab.build_config import BuildConfig
from fab.steps.grab.git import __current_commit, git_checkout, git_merge
from fab.steps.grab.git import current_commit, git_checkout, git_merge


@pytest.fixture
Expand All @@ -41,22 +41,22 @@ def test_checkout_url(self, tmp_path, url, config):
with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
git_checkout(config, src=url, dst_label='tiny_fortran')
# todo: The commit will keep changing. Perhaps make a non-changing branch
assert __current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'

def test_checkout_branch(self, tmp_path, url, config):
with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
git_checkout(config, src=url, dst_label='tiny_fortran', revision='main')
assert __current_commit(config.source_root / 'tiny_fortran') == '3cba55e'
assert current_commit(config.source_root / 'tiny_fortran') == '3cba55e'

def test_checkout_tag(self, tmp_path, url, config):
with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
git_checkout(config, src=url, dst_label='tiny_fortran', revision='early')
assert __current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'

def test_checkout_commit(self, tmp_path, url, config):
with pytest.warns(UserWarning, match="_metric_send_conn not set, cannot send metrics"):
git_checkout(config, src=url, dst_label='tiny_fortran', revision='ee5648928893701c5dbccdbf0561c0038352a5ff')
assert __current_commit(config.source_root / 'tiny_fortran') == 'ee56489'
assert current_commit(config.source_root / 'tiny_fortran') == 'ee56489'


# todo: we could do with a test to ensure left-over files from previous fetches are cleaned away
Expand Down

0 comments on commit 5677b42

Please sign in to comment.