You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2009/11/20 03:56:37 UTC

svn commit: r882392 - in /hadoop/avro/trunk: CHANGES.txt src/py/avro/__init__.py src/test/py/testimport.py

Author: cutting
Date: Fri Nov 20 02:56:37 2009
New Revision: 882392

URL: http://svn.apache.org/viewvc?rev=882392&view=rev
Log:
AVRO-202. Add __all__ listing to Python module to ease import.  Contributed by Jeff Hammerbacher.

Added:
    hadoop/avro/trunk/src/test/py/testimport.py
Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/src/py/avro/__init__.py

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=882392&r1=882391&r2=882392&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Nov 20 02:56:37 2009
@@ -82,6 +82,9 @@
     AVRO-216. Formatting cleanups to schema.py.
     (Jeff Hammerbacher via cutting)
 
+    AVRO-202. Add __all__ listing to Python module, to ease import.
+    (Jeff Hammerbacher via cutting)
+
   OPTIMIZATIONS
 
     AVRO-172. More efficient schema processing (massie)

Modified: hadoop/avro/trunk/src/py/avro/__init__.py
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/py/avro/__init__.py?rev=882392&r1=882391&r2=882392&view=diff
==============================================================================
--- hadoop/avro/trunk/src/py/avro/__init__.py (original)
+++ hadoop/avro/trunk/src/py/avro/__init__.py Fri Nov 20 02:56:37 2009
@@ -12,4 +12,7 @@
 # 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.
\ No newline at end of file
+# limitations under the License.
+
+__all__ = ['schema', 'protocol', 'io', 'ipc', 'genericio', 'genericipc',
+           'reflectio', 'reflectipc', 'datafile']

Added: hadoop/avro/trunk/src/test/py/testimport.py
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/py/testimport.py?rev=882392&view=auto
==============================================================================
--- hadoop/avro/trunk/src/test/py/testimport.py (added)
+++ hadoop/avro/trunk/src/test/py/testimport.py Fri Nov 20 02:56:37 2009
@@ -0,0 +1,31 @@
+# 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
+#
+# http://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.
+
+import unittest
+
+# need to do this here since "import *" in only allowed at module level
+from avro import *
+
+_PUBLIC_MODULES = ['schema', 'protocol', 'io', 'ipc', 'genericio', 'genericipc',
+                   'reflectio', 'reflectipc', 'datafile']
+
+class Test(unittest.TestCase):
+  def testimport_star(self):
+    found_modules = []
+    for module_ in _PUBLIC_MODULES:
+      if module_ in globals():
+        found_modules.append(module_)
+    self.assertEqual(_PUBLIC_MODULES, found_modules)