Skip to content

Commit 26626a2

Browse files
committed
Adding tox support for AppVeyor.
In the process, fixing some Windows PATH issues in "gcloud._helpers" and associated tests.
1 parent 808cc01 commit 26626a2

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

appveyor.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,38 @@ environment:
1919
- PYTHON: "C:\\Python27"
2020
PYTHON_VERSION: "2.7.11"
2121
PYTHON_ARCH: "32"
22+
TOX_ENV: "py27"
2223

2324
- PYTHON: "C:\\Python27-x64"
2425
PYTHON_VERSION: "2.7.11"
2526
PYTHON_ARCH: "64"
27+
TOX_ENV: "py27"
2628

2729
# Python 3.4.4 is the latest Python 3.4 with a Windows installer
2830
# Python 3.4.4 is the overall latest
2931
# https://www.python.org/ftp/python/3.4.4/
3032
- PYTHON: "C:\\Python34"
3133
PYTHON_VERSION: "3.4.4"
3234
PYTHON_ARCH: "32"
35+
TOX_ENV: "py34"
3336

3437
- PYTHON: "C:\\Python34-x64"
3538
PYTHON_VERSION: "3.4.4"
3639
PYTHON_ARCH: "64"
40+
TOX_ENV: "py34"
3741

3842
# Python 3.5.1 is the latest Python 3.5 with a Windows installer
3943
# Python 3.5.1 is the overall latest
4044
# https://www.python.org/ftp/python/3.5.1/
4145
- PYTHON: "C:\\Python35"
4246
PYTHON_VERSION: "3.5.1"
4347
PYTHON_ARCH: "32"
48+
TOX_ENV: "py35"
4449

4550
- PYTHON: "C:\\Python35-x64"
4651
PYTHON_VERSION: "3.5.1"
4752
PYTHON_ARCH: "64"
53+
TOX_ENV: "py35"
4854

4955
install:
5056
- ECHO "Filesystem root:"
@@ -83,7 +89,7 @@ build_script:
8389
test_script:
8490
- "%CMD_IN_ENV% pip list"
8591
# Run the project tests
86-
- "%CMD_IN_ENV% py.test"
92+
- "%CMD_IN_ENV% tox -e %TOX_ENV%"
8793

8894
after_test:
8995
# If tests are successful, create binary packages for the project.

appveyor/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# target Python version and architecture
55
wheel
66
pytest
7+
tox
78
cryptography
89
grpcio >= 1.0rc1
910
grpc-google-pubsub-v1

gcloud/_helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
(?P<nanos>\d{1,9}) # nanoseconds, maybe truncated
5858
Z # Zulu
5959
""", re.VERBOSE)
60-
DEFAULT_CONFIGURATION_PATH = '~/.config/gcloud/configurations/config_default'
60+
_USER_ROOT = os.path.expanduser('~')
61+
DEFAULT_CONFIGURATION_PATH = os.path.join(_USER_ROOT, '.config', 'gcloud',
62+
'configurations', 'config_default')
6163

6264

6365
class _LocalStack(Local):

unit_tests/test__helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ def setUp(self):
191191
if self.temp_APPDATA: # pragma: NO COVER Windows
192192
os.environ['APPDATA'] = self.temp_config_path
193193

194-
self.config_path = os.path.join(os.getenv('APPDATA', '~/.config'),
195-
'gcloud', 'configurations')
194+
config_default = os.path.join(os.path.expanduser('~'), '.config')
195+
config_dir = os.getenv('APPDATA', config_default)
196+
self.config_path = os.path.join(config_dir, 'gcloud',
197+
'configurations')
196198
conf_path = os.path.join(self.temp_config_path, self.config_path)
197199
os.makedirs(conf_path)
198200
self.temp_config_file = os.path.join(conf_path, self.config_file)

0 commit comments

Comments
 (0)