diff --git a/AUTHORS.rst b/AUTHORS.rst
index f5f32d78e..c6bb0ae4a 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -35,3 +35,5 @@ Contributors
 - Tom Parker (@palfrey)
 
 - Malcolm Box (@mbox)
+
+- Tom Petr (@tpetr)
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
index b4b20c743..c7d0d7a00 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1 @@
-include README.rst LICENSE HISTORY.rst AUTHORS.rst
+include README.rst LICENSE HISTORY.rst AUTHORS.rst run_tests.py
diff --git a/github3/issues.py b/github3/issues.py
index dbb007f8c..34e2e3d4c 100644
--- a/github3/issues.py
+++ b/github3/issues.py
@@ -344,8 +344,8 @@ def remove_label(self, name):
         :returns: bool
         """
         url = self._build_url('labels', name, base_url=self._api)
-        # Docs say it should be a list of strings returned, practice says it 
-        # is just a 204/404 response. I'm tenatively changing this until I 
+        # Docs say it should be a list of strings returned, practice says it
+        # is just a 204/404 response. I'm tenatively changing this until I
         # hear back from Support.
         return self._boolean(self._delete(url), 204, 404)
 
diff --git a/github3/packages/__init__.py b/github3/packages/__init__.py
index 24e098c82..af5e20780 100644
--- a/github3/packages/__init__.py
+++ b/github3/packages/__init__.py
@@ -1,3 +1,5 @@
 from __future__ import absolute_import
 
 from . import PySO8601
+
+# flake8: noqa
diff --git a/github3/repos.py b/github3/repos.py
index d3931eb82..b71e8d942 100644
--- a/github3/repos.py
+++ b/github3/repos.py
@@ -245,15 +245,16 @@ def compare_commits(self, base, head):
         json = self._json(self._get(url), 200)
         return Comparison(json) if json else None
 
-    def contents(self, path):
+    def contents(self, path, ref=None):
         """Get the contents of the file pointed to by ``path``.
 
         :param str path: (required), path to file, e.g.
             github3/repo.py
+        :param str ref: (optional), the string name of a commit/branch/tag. default: master
         :returns: :class:`Contents <Contents>` if successful, else None
         """
         url = self._build_url('contents', path, base_url=self._api)
-        json = self._json(self._get(url), 200)
+        json = self._json(self._get(url, params={'ref': ref}), 200)
         return Contents(json) if json else None
 
     @requires_auth
diff --git a/github3/structs.py b/github3/structs.py
index 4a598c06e..c06220dc8 100644
--- a/github3/structs.py
+++ b/github3/structs.py
@@ -14,9 +14,9 @@ def __init__(self, count, url, cls, session, params=None, etag=None):
         self.cls = cls
         #: Parameters of the query string
         self.params = params
-        # We do not set this from the parameter sent. We want this to 
+        # We do not set this from the parameter sent. We want this to
         # represent the ETag header returned by GitHub no matter what.
-        # If this is not None, then it won't be set from the response and 
+        # If this is not None, then it won't be set from the response and
         # that's not what we want.
         #: The ETag Header value returned by GitHub
         self.etag = None
diff --git a/run_tests.py b/run_tests.py
index 30d9f9b2b..4443ea772 100644
--- a/run_tests.py
+++ b/run_tests.py
@@ -14,7 +14,7 @@
     import mock
 except ImportError as ie:
     print('Please install the test dependencies as documented in the README')
-    raise ie
+    raise
 
 TEST_DIR = 'tests'
 
diff --git a/setup.py b/setup.py
index 53cecbbcb..ca85fd651 100755
--- a/setup.py
+++ b/setup.py
@@ -4,8 +4,19 @@
 import os
 import re
 
+kwargs = {}
+requires = []
+packages = [
+    "github3",
+    "github3.packages",
+    "github3.packages.PySO8601",
+]
+
 try:
     from setuptools import setup
+    kwargs['test_suite'] = 'run_tests.main'
+    requires = ['mock', 'expecter', 'coverage==3.5.2']
+    packages.append('tests')
 except ImportError:
     from distutils.core import setup  # NOQA
 
@@ -13,12 +24,7 @@
     os.system("python setup.py sdist upload")
     sys.exit()
 
-packages = [
-    "github3",
-    "github3.packages",
-    "github3.packages.PySO8601",
-]
-requires = ["requests==1.1.0"]
+requires.append("requests==1.1.0")
 
 __version__ = ''
 with open('github3/__init__.py', 'r') as fd:
@@ -60,4 +66,5 @@
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: Implementation :: CPython',
     ],
+    **kwargs
 )
diff --git a/tests/test_repos.py b/tests/test_repos.py
index 65c30a8c3..0243cb45f 100644
--- a/tests/test_repos.py
+++ b/tests/test_repos.py
@@ -126,6 +126,15 @@ def test_contents(self):
         self.response('', 404)
         expect(self.repo.contents(filename)).is_None()
 
+    def test_contents_ref(self):
+        self.response('contents')
+        filename = 'setup.py'
+        self.get(self.api + 'contents/' + filename)
+        self.conf = {'params': {'ref': 'foo'}}
+
+        expect(self.repo.contents(filename, ref='foo')).isinstance(github3.repos.Contents)
+        self.mock_assertions()
+
     def test_create_blob(self):
         self.response('blob', 201)
         content = 'VGVzdCBibG9i\n'