Repository: googleapis/google-cloud-python

Issue:
Current `tox` configuration ends up testing old code
For example:

``` bash
$ rm -r .tox/
$ tox -e system-tests --notest
GLOB sdist-make: /home/tseaver/projects/agendaless/Google/src/google-cloud-python/setup.py
system-tests create: /home/tseaver/projects/agendaless/Google/src/google-cloud-python/.tox/system-tests
system-tests inst: /home/tseaver/projects/agendaless/Google/src/google-cloud-python/.tox/dist/google-cloud-0.20.0.zip
system-tests installed: -f file:///home/tseaver/.pip/wheels,enum34==1.1.6,future==0.15.2,futures==3.0.5,gapic-google-logging-v2==0.10.1,gapic-google-pubsub-v1==0.10.1,google-cloud==0.20.0,google-cloud-bigquery==0.20.0,google-cloud-bigtable==0.20.0,google-cloud-core==0.20.0,google-cloud-datastore==0.20.0,google-cloud-dns==0.20.0,google-cloud-error-reporting==0.20.0,google-cloud-happybase==0.20.0,google-cloud-language==0.20.0,google-cloud-logging==0.20.0,google-cloud-monitoring==0.20.0,google-cloud-pubsub==0.20.0,google-cloud-resource-manager==0.20.0,google-cloud-storage==0.20.0,google-cloud-translate==0.20.0,google-cloud-vision==0.20.0,google-gax==0.14.1,googleapis-common-protos==1.3.5,grpc-google-iam-v1==0.10.1,grpc-google-logging-v2==0.10.1,grpc-google-pubsub-v1==0.10.1,grpcio==1.0.0,httplib2==0.9.2,oauth2client==3.0.0,ply==3.8,protobuf==3.1.0.post1,pyasn1==0.1.9,pyasn1-modules==0.0.8,rsa==3.4.2,six==1.10.0
___________________________________ summary ____________________________________
  system-tests: skipped tests
  congratulations :)
$ diff -ru .tox/system-tests/lib/python2.7/site-packages/google/cloud/storage/ storage/google/cloud/storage/ --exclude="*.pyc"
diff -ru '--exclude=*.pyc' .tox/system-tests/lib/python2.7/site-packages/google/cloud/storage/blob.py storage/google/cloud/storage/blob.py
--- .tox/system-tests/lib/python2.7/site-packages/google/cloud/storage/blob.py  2016-10-05 18:15:48.724796000 -0400
+++ storage/google/cloud/storage/blob.py    2016-10-05 18:02:55.872830411 -0400
@@ -655,6 +655,32 @@
         self.acl.all().grant_read()
         self.acl.save(client=client)

+    def compose(self, sources, client=None):
+        """Concatenate source blobs into this one.
+
+        :type sources: list of :class:`Blob`
+        :param sources: blobs whose contents will be composed into this blob.
+
+        :type client: :class:`~google.cloud.storage.client.Client` or
+                      ``NoneType``
+        :param client: Optional. The client to use.  If not passed, falls back
+                       to the ``client`` stored on the blob's bucket.
+
+        :raises: :exc:`ValueError` if this blob does not have its
+                 :attr:`content_type` set.
+        """
+        if self.content_type is None:
+            raise ValueError("Destination 'content_type' not set.")
+        client = self._require_client(client)
+        request = {
+            'sourceObjects': [{'name': source.name} for source in sources],
+            'destination': self._properties.copy(),
+        }
+        api_response = client.connection.api_request(
+            method='POST', path=self.path + '/compose', data=request,
+            _target_object=self)
+        self._set_properties(api_response)
+
     cache_control = _scalar_property('cacheControl')
     """HTTP 'Cache-Control' header for this object.
```

Somehow, the tarball / wheel is being cached.



Discussion:
If you check out

```
.tox/system-tests/log/system-tests-1.log
```

it just says

```
Collecting google-cloud-bigquery>=0.20.0 (from google-cloud==0.20.0)
  Using cached google_cloud_bigquery-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-bigtable>=0.20.0 (from google-cloud==0.20.0)
  Using cached google_cloud_bigtable-0.20.0-py2.py3-none-any.whl
```

I'm trying to figure out what cache is being used.

I checked my global cache and found a few different wheels for each subpackage, e.g. 

```
$ find ${HOME}/.cache/pip/ | grep datastore
${HOME}/.cache/pip/wheels/b8/2f/53/551544c447cce8706fbcd879c70e47b436eedf9baf877a21a6/google_cloud_datastore-0.20.0-py2.py3-none-any.whl
${HOME}/.cache/pip/wheels/68/28/f3/abd1e3d034ddafbb13a3837a7c74eba1cf85a9d57387409e5e/google_cloud_datastore-0.20.0.dev0-cp27-none-any.whl
${HOME}/.cache/pip/wheels/68/28/f3/abd1e3d034ddafbb13a3837a7c74eba1cf85a9d57387409e5e/google_cloud_datastore-0.20.0.dev0-cp35-none-any.whl
${HOME}/.cache/pip/wheels/68/28/f3/abd1e3d034ddafbb13a3837a7c74eba1cf85a9d57387409e5e/google_cloud_datastore-0.20.0.dev0-cp34-none-any.whl
```

`.tox/cover/log/cover-1.log` has

```
cmdargs: [local('.../google-cloud-python/.tox/cover/bin/pip'), 'install',
          '.../google-cloud-python/core',
          '.../google-cloud-python/bigtable',
          '.../google-cloud-python/storage',
          '.../google-cloud-python/datastore',
          '.../google-cloud-python/bigquery',
          '.../google-cloud-python/pubsub',
          '.../google-cloud-python/logging',
          '.../google-cloud-python/dns',
          '.../google-cloud-python/language',
          '.../google-cloud-python/error_reporting',
          '.../google-cloud-python/resource_manager',
          '.../google-cloud-python/monitoring',
          '.../google-cloud-python/vision',
          '.../google-cloud-python/translate',
          '.../google-cloud-python/speech',
          'pytest', 'coverage', 'pytest-cov']
```

while `.tox/system-tests/log/system-tests-1.log` (as well as `.tox/cover/log/cover-2.log`) has

```
cmdargs: [local('.../google-cloud-python/.tox/system-tests/bin/pip'),
          'install',
          '.../google-cloud-python/.tox/dist/google-cloud-0.20.0.zip']
```

Seems strange

OK it isn't strange. Fix coming.


Resolving patch:
diff --git a/scripts/pycodestyle_on_repo.py b/scripts/pycodestyle_on_repo.py
--- a/scripts/pycodestyle_on_repo.py
+++ b/scripts/pycodestyle_on_repo.py
@@ -19,6 +19,8 @@
 """
 
 
+from __future__ import print_function
+
 import os
 import subprocess
 import sys
@@ -35,9 +37,12 @@ def main():
     python_files = [
         candidate for candidate in candidates if candidate.endswith('.py')]
 
-    pycodestyle_command = ['pycodestyle'] + python_files
-    status_code = subprocess.call(pycodestyle_command)
-    sys.exit(status_code)
+    if not python_files:
+        print('No Python files to lint, exiting.')
+    else:
+        pycodestyle_command = ['pycodestyle'] + python_files
+        status_code = subprocess.call(pycodestyle_command)
+        sys.exit(status_code)
 
 
 if __name__ == '__main__':


Test patch: