Skip to content

Commit

Permalink
#9: added test to control requested local branch not in remote behavi…
Browse files Browse the repository at this point in the history
…our.
  • Loading branch information
jmnavarrol committed Oct 20, 2023
1 parent a951f43 commit 14221a4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* setup.py deleted as it's needed no more along setuptools.
* setup.cfg declared UTF-8.
* Development dependencies relaxed.
* Working on [#9](https://github.com/jmnavarrol/python-multigit/issues/9) BUG CORRECTED: uncontrolled error when requested a branch which exists locally but not on remote.

## 0.11.4-2
### Added
Expand Down
2 changes: 1 addition & 1 deletion src/multigit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:source: https://github.com/jmnavarrol/python-multigit
"""

__version__ = '0.11.4-2'
__version__ = '0.11.5-1'

# Import stuff
import os, sys
Expand Down
23 changes: 23 additions & 0 deletions src/tests/test_gitrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Import stuff
import unittest
from git import Repo
from . import TESTS_PATH, PROJECT_PATH

import os, shutil
Expand Down Expand Up @@ -56,6 +57,28 @@ def test_nonexitent_branch(self):
self.assertEqual(result['status'], 'ERROR')


def test_local_not_in_remote(self):
print("TEST: 'test_local_not_in_remote'")
# prepares a suitable configuration
repoconf = {}
repoconf['repo'] = '[email protected]:jmnavarrol/simplest-git-subrepos.git'
repoconf['path'] = os.path.join(self.scenarios_path, 'standard/simplest-git-subrepos')

# First, let's clone the repo
result = self.gitrepo.update(repoconf)
print(str(result))
# Then, let's create a local branch
repo = Repo(repoconf['path'])
new_branch = repo.create_head('new_branch')
new_branch.checkout()
# Finally, let's update config to request the new local branch
repoconf['branch'] = 'new_branch'
repoconf['gitref_type'] = 'branch'
result = self.gitrepo.update(repoconf)
print(str(result))
self.assertEqual(result['status'], 'ERROR')


def test_status_not_cloned(self):
print("TEST: 'test_status_not_cloned'")
# prepares a suitable configuration
Expand Down

0 comments on commit 14221a4

Please sign in to comment.