Commit a4ba7269 authored by David Diederich's avatar David Diederich
Browse files

Merge branch '2-allow-running-from-subdirectories-of-git-repos' into 'main'

Resolve "Allow running from subdirectories of Git Repos"

Closes #2

See merge request !4
parents f99644a3 8c1fd7ad
Pipeline #119480 passed with stages
in 8 minutes and 10 seconds
......@@ -39,3 +39,7 @@ Feature: Git Repository Processing to set configuration
And configuration is built
Then logs include "Commit SHA = 60acdc"
Scenario: Running from Subdirectory of Repository Root
Given configuration is built
Then the Git Repo searches parent directories
import pint
import os
from unittest.mock import patch, PropertyMock, DEFAULT
from behave import *
......@@ -32,6 +33,7 @@ def buildConfigObject(context, Repo, time, node, getenv):
return getattr(context, 'modifiedFiles', False) or (getattr(context, 'untrackedFiles', False) and untracked)
Repo.return_value.is_dirty.side_effect = is_dirty
context.Repo = Repo
# --------------------
......@@ -118,3 +120,10 @@ def testTimeProperty(context, attrName, value, units):
@then("the configuration's {attrName} is None")
def testNoneProperty(context, attrName):
assert getattr(context.configObj, attrName) is None
# ----------------------------------------
# Git Repo
@then('the Git Repo searches parent directories')
def searchParentDirs(context):
context.Repo.assert_called_with(os.getcwd(), search_parent_directories=True)
......@@ -12,7 +12,7 @@ log = logging.getLogger('fossa-with-cache')
class Config:
def __init__(self, units):
self.valid = True
self.repo = git.Repo(os.getcwd())
self.repo = git.Repo(os.getcwd(), search_parent_directories=True)
self.gatherGitDetails()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment