Skip to content

Commit

Permalink
Removing tests adding git function
Browse files Browse the repository at this point in the history
  • Loading branch information
onlynone committed Apr 17, 2015
1 parent b6d43b6 commit f98575d
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 144 deletions.
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

25 changes: 4 additions & 21 deletions CONTRIBUTING.rst
Expand Up @@ -74,38 +74,21 @@ Ready to contribute? Here's how to set up `pysysgit` for local development.

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::

$ flake8 sysgit tests
$ python setup.py test
$ tox

To get flake8 and tox, just pip install them into your virtualenv.

6. Commit your changes and push your branch to GitHub::
5. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.
6. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
1. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check
https://travis-ci.org/onlynone/pysysgit/pull_requests
and make sure that the tests pass for all supported Python versions.

Tips
----

To run a subset of tests::
2. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy.

$ python -m unittest tests.test_sysgit
1 change: 0 additions & 1 deletion MANIFEST.in
Expand Up @@ -4,7 +4,6 @@ include HISTORY.rst
include LICENSE
include README.rst

recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

Expand Down
70 changes: 0 additions & 70 deletions Makefile

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py
Expand Up @@ -18,10 +18,6 @@
# TODO: put package requirements here
]

test_requirements = [
# TODO: put package test requirements here
]

setup(
name='sysgit',
version='0.1.0',
Expand Down Expand Up @@ -52,6 +48,4 @@
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
],
test_suite='tests',
tests_require=test_requirements
)
4 changes: 4 additions & 0 deletions sysgit/__init__.py
Expand Up @@ -3,3 +3,7 @@
__author__ = 'Steven Willis'
__email__ = 'onlynone@gmail.com'
__version__ = '0.1.0'

__all__ = ["git"]

from .utils import git
1 change: 0 additions & 1 deletion sysgit/sysgit.py

This file was deleted.

89 changes: 89 additions & 0 deletions sysgit/utils.py
@@ -0,0 +1,89 @@
# -*- coding: utf-8 -*-
import os
import errno
import subprocess

__all__ = ["mkdir_p", "touch", "git", "CALL", "CHECK_CALL", "CHECK_OUTPUT"]

CALL = 'call'
CHECK_CALL = 'check_call'
CHECK_OUTPUT = 'check_output'

__sub_calls = {
CALL: subprocess.call,
CHECK_CALL: subprocess.check_call,
CHECK_OUTPUT: subprocess.check_output
}

__default_subprocess_kwargs = {
'close_fds': True,
'shell': False,
}

def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise


def touch(fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)


def git(*args, **kwargs):
"""Execute git commands
Args:
*args: The positional arguments are used as arguments to the git
command. For example, the following python code:
git("commit", "--help")
would execute:
git commit --help
f: One of CALL, CHECK_CALL, or CHECK_OUTPUT. Corresponds to the function
from the subprocess module called to execute git. Defaults to CHECK_CALL
**kwargs: The keyword arguments are passed through to the subprocess
function as-is.
Returns:
Whatever is returned by the respective subprocess function. For example,
f=CALL would return the returncode attribute, and f=CHECK_OUTPUT would
return the content of stdout.
Exmples:
The following call:
git("commit", "-m", "Commit Message", cwd="/path/to/repo")
results in:
subprocess.check_call(["git", "commit", "-m", "Commit Message"], cwd="/path/to/repo")
And:
git("checkout", "-b", "branch_name", f=CHECK_OUTPUT, cwd="/path/to/repo")
results in:
subprocess.check_output(["git", "checkout", "-b", "branch_name"], cwd="/path/to/repo")
"""

f = kwargs.pop('f', CHECK_CALL)
f = __sub_calls[f]

full_args = ("git",) + tuple(args)

full_kwargs = __default_subprocess_kwargs.copy()
full_kwargs.update(kwargs)

return f(full_args, **full_kwargs)
1 change: 0 additions & 1 deletion tests/__init__.py

This file was deleted.

28 changes: 0 additions & 28 deletions tests/test_sysgit.py

This file was deleted.

0 comments on commit f98575d

Please sign in to comment.