Skip to content

Commit

Permalink
Get nosetests working after removing the setup.py change
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourabh Bajaj authored and aaltay committed Feb 9, 2017
1 parent 490ef8f commit c6343e5
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ env/
# committed.
dependency-reduced-pom.xml

# The build process copies the standard_coders.yaml file into Python module,
# but it shouldn't be committed.
sdks/python/apache_beam/coders/standard_coders.yaml

# Hotspot VM leaves this log in a non-target directory when java crashes
hs_err_pid*.log

Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/coders/standard_coders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def quote(s):


STANDARD_CODERS_YAML = os.path.join(
os.path.dirname(__file__), 'standard_coders.yaml')
os.path.dirname(__file__), '..', 'tests/data/standard_coders.yaml')
StandardCodersTest._create_tests(STANDARD_CODERS_YAML)


Expand Down
98 changes: 98 additions & 0 deletions sdks/python/apache_beam/tests/data/standard_coders.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This file is broken into multiple sections delimited by ---. Each section specifies a set of
# reference encodings for a single standardized coder used in a specific context.
#
# Each section contains up to 3 properties:
#
# coder: a common coder spec. Currently, a URN and URNs for component coders as necessary.
# nested: a boolean meaning whether the coder was used in the nested context. Missing means to
# test both contexts, a shorthand for when the coder is invariant across context.
# examples: a map of {encoded bytes: original JSON object} encoded with the coder in the context.
# The LHS (key) is a byte array encoded as a JSON-escaped string. The RHS (value) is
# one of a few standard JSON types such as numbers, strings, dicts that map naturally
# to the type encoded by the coder.
#
# These choices were made to strike a balance between portability, ease of use, and simple
# legibility of this file itself.
#
# It is expected that future work will move the `coder` field into a format that it would be
# represented by the Runner API, so that it can be understood by all SDKs and harnesses.


coder:
urn: "urn:beam:coders:bytes:0.1"
nested: false
examples:
"abc": abc
"ab\0c": "ab\0c"

---

coder:
urn: "urn:beam:coders:bytes:0.1"
nested: true
examples:
"\u0003abc": abc
"\u0004ab\0c": "ab\0c"
"\u00c8\u0001 10| 20| 30| 40| 50| 60| 70| 80| 90| 100| 110| 120| 130| 140| 150| 160| 170| 180| 190| 200|":
" 10| 20| 30| 40| 50| 60| 70| 80| 90| 100| 110| 120| 130| 140| 150| 160| 170| 180| 190| 200|"

---

coder:
urn: "urn:beam:coders:varint:0.1"
examples:
"\0": 0
"\u0001": 1
"\u000A": 10
"\u00c8\u0001": 200
"\u00e8\u0007": 1000
"\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001": -1

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:varint:0.1"}]
examples:
"\u0003abc\0": {key: abc, value: 0}
"\u0004ab\0c\u000A": {key: "ab\0c", value: 10}

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:bytes:0.1"}]
nested: false
examples:
"\u0003abcdef": {key: abc, value: def}
"\u0004ab\0cde\0f": {key: "ab\0c", value: "de\0f"}

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:bytes:0.1"}]
nested: true
examples:
"\u0003abc\u0003def": {key: abc, value: def}
"\u0004ab\0c\u0004de\0f": {key: "ab\0c", value: "de\0f"}
12 changes: 0 additions & 12 deletions sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ def get_version():
except ImportError:
cythonize = lambda *args, **kwargs: []

# Copy standard_coders.yaml from the common resource location.
STANDARD_CODER_COMMON_PATH = ("../common/fn-api/src/test/resources/"
"org/apache/beam/fn/v1/standard_coders.yaml")
STANDARD_CODER_TEST_PATH = "apache_beam/coders/standard_coders.yaml"
if os.path.exists:
try:
shutil.copyfile(STANDARD_CODER_COMMON_PATH, STANDARD_CODER_TEST_PATH)
except:
# do nothing; the test might fail later
pass


REQUIRED_PACKAGES = [
'avro>=1.7.7,<2.0.0',
'crcmod>=1.7,<2.0',
Expand Down

0 comments on commit c6343e5

Please sign in to comment.