Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Protobuf 3.2.0 #1634

Closed
wants to merge 6 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sudo: false
cache:
directories:
- $HOME/.cache/pip
- /tmp/proto3.1.0
- /tmp/proto3.2.0

install:
- pip install pip --upgrade
Expand All @@ -24,8 +24,8 @@ before_script:
- python scripts/build_test_data.py

before_install:
- bash tools/travis-install-protoc.sh 3.1.0
- export PATH=/tmp/proto3.1.0/bin:$PATH
- bash tools/travis-install-protoc.sh 3.2.0
- export PATH=/tmp/proto3.2.0/bin:$PATH

# run_tests.py runs everything under the script: tag so only put commands
# under it that we want to run (and want to be able to run) as local tests
Expand Down
4 changes: 2 additions & 2 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
# the pinned packages in requirements.txt are used instead.
#
#git+git://github.com/ga4gh/ga4gh-common.git@master#egg=ga4gh_common
#git+git://github.com/ga4gh/schemas.git@master#egg=ga4gh_schemas
#git+git://github.com/ga4gh/ga4gh-client.git@master#egg=ga4gh_client
git+git://github.com/ljdursi/ga4gh-schemas.git@protobuf_3.2.0#egg=ga4gh_schemas
git+git://github.com/ljdursi/ga4gh-client.git@protobuf_3.2.0#egg=ga4gh_client
2 changes: 1 addition & 1 deletion ga4gh/server/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _readGroupSetsGenerator(self, request, numObjects, getByIndexMethod):
if request.name and request.name != obj.getLocalId():
include = False
if request.biosample_id and include:
rgsp.ClearField("read_groups")
rgsp.ClearField(b"read_groups")
for readGroup in obj.getReadGroups():
if request.biosample_id == readGroup.getBiosampleId():
rgsp.read_groups.extend(
Expand Down
2 changes: 1 addition & 1 deletion ga4gh/server/datamodel/reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def convertReadAlignment(self, read, readGroupSet, readGroupId):
ret.aligned_quality.extend(read.query_qualities)
ret.aligned_sequence = read.query_sequence
if SamFlags.isFlagSet(read.flag, SamFlags.READ_UNMAPPED):
ret.ClearField("alignment")
ret.ClearField(b"alignment")
else:
ret.alignment.CopyFrom(protocol.LinearAlignment())
ret.alignment.mapping_quality = read.mapping_quality
Expand Down
2 changes: 1 addition & 1 deletion ga4gh/server/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _removeNonMatchingTranscriptEffects(self, ann):
add = True
if add:
newTxE.append(txe)
ann.ClearField('transcript_effects')
ann.ClearField(b'transcript_effects')
ann.transcript_effects.extend(newTxE)
return ann

Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# the constraints file will point at the current master branch
# of the respective module.
ga4gh-common==0.0.7
ga4gh-schemas==0.6.0a10.post1
ga4gh-client==0.6.0a10
ga4gh-schemas
ga4gh-client

Werkzeug==0.11.5
MarkupSafe==0.23
Expand Down Expand Up @@ -46,7 +46,7 @@ peewee==2.8.5
# prefix due to a setuptools bug.
Flask-Cors==2.0.1
Flask==0.10.1
protobuf==3.1.0.post1
protobuf==3.2.0
humanize==0.5.1
pysam==0.9.0
requests==2.7.0
Expand Down
10 changes: 10 additions & 0 deletions tests/datadriven/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import fnmatch
import os
import inspect
import array

import google.protobuf.json_format as json_format

Expand Down Expand Up @@ -68,9 +69,18 @@ def assertEqual(self, a, b):
Tests if a an b are equal. If not, output an error and raise
an assertion error.
"""
def compare_as_float_32s(a_dbl, b_dbl):
a_flt = array.array(b"f", [a_dbl])[0]
b_flt = array.array(b"f", [b_dbl])[0]
return a_flt == b_flt

if a == b:
return

if isinstance(a, float) and isinstance(b, float):
if compare_as_float_32s(a, b):
return

# Protocol Buffers has default string as "", not None
if a in TestCase.consideredNone and b in TestCase.consideredNone:
return
Expand Down
10 changes: 9 additions & 1 deletion tests/unit/test_simulated_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import random
import json
import array
import ga4gh.server.datamodel.reads as reads
import ga4gh.server.datamodel.references as references
import ga4gh.server.datamodel.variants as variants
Expand Down Expand Up @@ -52,6 +53,12 @@ def setUpClass(cls):
def tearDownClass(cls):
cls.app = None

@classmethod
def as_float32(cls, x):
x_dbl = float(x)
x_flt = array.array(b"f", [x_dbl])[0]
return x_flt

def setUp(self):
self.backend = frontend.app.backend
self.dataRepo = self.backend.getDataRepository()
Expand Down Expand Up @@ -217,7 +224,8 @@ def verifyReferencesEqual(self, gaReference, reference):
gaReference.source_accessions, reference.getSourceAccessions())
self.assertEqual(gaReference.is_derived, reference.getIsDerived())
self.assertEqual(
gaReference.source_divergence, reference.getSourceDivergence())
TestSimulatedStack.as_float32(gaReference.source_divergence),
TestSimulatedStack.as_float32(reference.getSourceDivergence()))

def verifySearchMethod(
self, request, path, responseClass, objects, objectVerifier):
Expand Down