Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.py[co]
venv/
.tox/
*.egg-info
15 changes: 11 additions & 4 deletions gistit.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def _expect_created(self, response, message):
import subprocess


def check_output(*args, **kwargs):
output = subprocess.check_output(*args, **kwargs)
if isinstance(output, bytes):
return output.decode('utf-8')
return output


class PathGenerationTestCase(unittest.TestCase):
def test_single_yields_only_filename(self):
path = '/foo/bar.py'
Expand Down Expand Up @@ -312,18 +319,18 @@ def test_create_parser_contextual(self):

class ReadmeUsageTestCase(unittest.TestCase):
def assertReadmeContainsOutput(self, args):
with open('README.rst') as f:
with io.open('README.rst', encoding='utf-8') as f:
readme = f.read()

cmd_args = [sys.executable, 'gistit.py']
cmd_args.extend(args)
output_lines = subprocess.check_output(cmd_args).splitlines()
output_lines = check_output(cmd_args).splitlines()
output_lines = [line.rstrip() for line in output_lines]
indented_output_lines = []
for line in output_lines:
indented_line = ' ' + line if line else ''
indented_line = u' ' + line if line else u''
indented_output_lines.append(indented_line)
indented_output = '\n'.join(indented_output_lines) + '\n'
indented_output = u'\n'.join(indented_output_lines) + u'\n'
self.assertIn(indented_output, readme)


Expand Down
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from setuptools import setup

setup(
name='gistit',
version='0.1.0-dev',
author='Colin Dunklau',
author_email='colin.dunklau@gmail.com',
py_modules=['gistit'],
install_requires=['requests >=2.0,<3.0'],
)
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tox]
envlist = py27,py36,py37

[testenv]
commands =
{envpython} -m unittest gistit