forked from timbrel/GitSavvy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[run] | ||
omit = | ||
*/common/vendor/* | ||
*/tests/* | ||
common/vendor/* | ||
tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
env: | ||
global: | ||
- PACKAGE="GitSavvy" | ||
- SUBLIME_TEXT_VERSION="3" | ||
- UNITTESTING_TAG="master" | ||
|
||
matrix: | ||
include: | ||
- os: linux | ||
language: python | ||
python: 3.3 | ||
- os: osx | ||
language: generic | ||
|
||
before_install: | ||
- curl -OL https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/travis.sh | ||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then | ||
export DISPLAY=:99.0; | ||
sh -e /etc/init.d/xvfb start; | ||
fi | ||
- git config --global user.email gitsavvy@gitsavvy.com | ||
- git config --global user.name GitSavvy | ||
|
||
install: | ||
- sh travis.sh bootstrap | ||
- sh travis.sh install_package_control | ||
|
||
script: | ||
- sh travis.sh run_tests --coverage | ||
|
||
after_success: | ||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
brew update; | ||
brew install python3; | ||
pip3 install python-coveralls; | ||
fi | ||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then | ||
echo `python --version`; | ||
pip install python-coveralls; | ||
fi | ||
- coveralls | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
environment: | ||
PACKAGE: "GitSavvy" | ||
SUBLIME_TEXT_VERSION : "3" | ||
UNITTESTING_TAG : "master" | ||
|
||
install: | ||
- ps: appveyor DownloadFile "https://raw.githubusercontent.com/randy3k/UnitTesting/master/sbin/appveyor.ps1" | ||
- ps: .\appveyor.ps1 "bootstrap" -verbose | ||
- ps: .\appveyor.ps1 "install_package_control" -verbose | ||
|
||
build: off | ||
|
||
test_script: | ||
- ps: .\appveyor.ps1 "run_tests" -verbose |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class AssertionsMixin: | ||
|
||
def assert_git_status(self, status): | ||
""" | ||
Assertion of the current git status. `status` should be a list of 4 intergers: | ||
The lengths of the staged, unstaged, untracked and conflicted entries. | ||
""" | ||
self.assertEqual( | ||
[len(x) for x in self.sort_status_entries(self.get_status())], | ||
status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import sublime | ||
import os | ||
import subprocess | ||
from unittesting.helpers import TempDirectoryTestCase | ||
from .common import AssertionsMixin | ||
from GitSavvy.core import git_command | ||
|
||
|
||
def tidy_path(path): | ||
return os.path.realpath(os.path.normcase(path)) | ||
|
||
|
||
class TestInitialization(TempDirectoryTestCase, AssertionsMixin, git_command.GitCommand): | ||
""" | ||
TempDirectoryTestCase is a subclass of DeferrableTestCase which creates and opens a temp | ||
directory before running the test case and close the window when the test case finishes running. | ||
https://github.com/randy3k/UnitTesting/blob/master/unittesting/helpers.py | ||
""" | ||
|
||
def test_01_init(self): | ||
self.assertEqual( | ||
tidy_path(self._temp_dir), | ||
tidy_path(sublime.active_window().folders()[0])) | ||
subprocess.check_call(["git", "init"], cwd=self._temp_dir) | ||
self.assertEqual( | ||
tidy_path(self._temp_dir), | ||
tidy_path(self.window.folders()[0])) | ||
|
||
def test_02_add_first_file(self): | ||
readme = os.path.join(self.repo_path, "README.md") | ||
f = open(readme, "w") | ||
f.write("README") | ||
f.close() | ||
self.git("add", "README.md") | ||
self.git("commit", "-m", "Init") | ||
|
||
def test_03_is_master(self): | ||
branch = self.get_current_branch_name() | ||
self.assertEqual(branch, "master") | ||
|
||
def test_04_untrack_file(self): | ||
foo = os.path.join(self.repo_path, "foo") | ||
with open(foo, "w") as f: | ||
f.write("foo") | ||
self.assert_git_status([0, 0, 1, 0]) | ||
self.stage_file(foo) | ||
self.assert_git_status([1, 0, 0, 0]) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"deferred": true, | ||
"capture_console": true | ||
} |