Skip to content

Commit

Permalink
Share data files between Py2 and Py3 test suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
xitology committed Dec 29, 2008
1 parent 7a3510a commit d765a6c
Show file tree
Hide file tree
Showing 598 changed files with 29 additions and 3,034 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include README LICENSE CHANGES setup.py
recursive-include examples *.py *.cfg *.yaml
recursive-include tests *.py
recursive-include tests/data *
recursive-include tests/lib *.py
recursive-include tests/lib3 *.py
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ installext:
${PYTHON} setup.py --with-libyaml install ${PARAMETERS}

test: build
${PYTHON} tests/test_build.py ${TEST}
${PYTHON} tests/lib/test_build.py ${TEST}

testext: buildext
${PYTHON} tests/test_build_ext.py ${TEST}
${PYTHON} tests/lib/test_build_ext.py ${TEST}

testall:
${PYTHON} setup.py test
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def run(self):
build_cmd.run()
sys.path.insert(0, build_cmd.build_lib)
if sys.version_info[0] < 3:
sys.path.insert(0, 'tests')
sys.path.insert(0, 'tests/lib')
else:
sys.path.insert(0, 'tests3')
sys.path.insert(0, 'tests/lib3')
import test_all
test_all.main([])

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/data/construct-python-name-module.code
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[file, yaml.Loader, yaml.dump, abs, yaml.tokens]
[str, yaml.Loader, yaml.dump, abs, yaml.tokens]
2 changes: 1 addition & 1 deletion tests/data/construct-python-name-module.data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- !!python/name:file
- !!python/name:str
- !!python/name:yaml.Loader
- !!python/name:yaml.dump
- !!python/name:abs
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/data/serializer-is-already-opened.dumper-error
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dumper = yaml.Dumper(StringIO.StringIO())
dumper = yaml.Dumper(StringIO())
dumper.open()
dumper.open()
2 changes: 1 addition & 1 deletion tests/data/serializer-is-closed-1.dumper-error
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dumper = yaml.Dumper(StringIO.StringIO())
dumper = yaml.Dumper(StringIO())
dumper.open()
dumper.close()
dumper.open()
2 changes: 1 addition & 1 deletion tests/data/serializer-is-closed-2.dumper-error
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dumper = yaml.Dumper(StringIO.StringIO())
dumper = yaml.Dumper(StringIO())
dumper.open()
dumper.close()
dumper.serialize(yaml.ScalarNode(tag='!foo', value='bar'))
2 changes: 1 addition & 1 deletion tests/data/serializer-is-not-opened-1.dumper-error
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dumper = yaml.Dumper(StringIO.StringIO())
dumper = yaml.Dumper(StringIO())
dumper.close()
2 changes: 1 addition & 1 deletion tests/data/serializer-is-not-opened-2.dumper-error
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dumper = yaml.Dumper(StringIO.StringIO())
dumper = yaml.Dumper(StringIO())
dumper.serialize(yaml.ScalarNode(tag='!foo', value='bar'))
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/test_appliance.py → tests/lib/test_appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def find_test_filenames(directory):
for filename in os.listdir(directory):
if os.path.isfile(os.path.join(directory, filename)):
base, ext = os.path.splitext(filename)
if base.endswith('-py3'):
continue
filenames.setdefault(base, []).append(ext)
filenames = filenames.items()
filenames.sort()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/test_errors.py → tests/lib/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def test_emitter_error(error_filename, verbose=False):
def test_dumper_error(error_filename, verbose=False):
code = open(error_filename, 'rb').read()
try:
import yaml, StringIO
import yaml
from StringIO import StringIO
exec code
except yaml.YAMLError, exc:
if verbose:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion tests3/test_appliance.py → tests/lib3/test_appliance.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import sys, os, os.path, types, traceback, pprint

DATA = 'tests3/data'
DATA = 'tests/data'

def find_test_functions(collections):
if not isinstance(collections, list):
Expand All @@ -21,6 +21,8 @@ def find_test_filenames(directory):
for filename in os.listdir(directory):
if os.path.isfile(os.path.join(directory, filename)):
base, ext = os.path.splitext(filename)
if base.endswith('-py2'):
continue
filenames.setdefault(base, []).append(ext)
filenames = sorted(filenames.items())
return filenames
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 7 additions & 2 deletions tests3/test_constructor.py → tests/lib3/test_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ def execute(code):

def _make_objects():
global MyLoader, MyDumper, MyTestClass1, MyTestClass2, MyTestClass3, YAMLObject1, YAMLObject2, \
AnObject, AnInstance, AState, ACustomState, NewArgs, NewArgsWithState, \
Reduce, ReduceWithState, MyInt, MyList, MyDict, FixedOffset, execute
AnObject, AnInstance, AState, ACustomState, InitArgs, InitArgsWithState, \
NewArgs, NewArgsWithState, Reduce, ReduceWithState, MyInt, MyList, MyDict, \
FixedOffset, execute

class MyLoader(yaml.Loader):
pass
Expand Down Expand Up @@ -157,6 +158,10 @@ def __getstate__(self):
def __setstate__(self, state):
self.baz = state

InitArgs = NewArgs

InitArgsWithState = NewArgsWithState

class Reduce(AnObject):
def __reduce__(self):
return self.__class__, (self.foo, self.bar, self.baz)
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion tests3/test_errors.py → tests/lib3/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def test_emitter_error(error_filename, verbose=False):
def test_dumper_error(error_filename, verbose=False):
code = open(error_filename, 'rb').read()
try:
import yaml, io
import yaml
from io import StringIO
exec(code)
except yaml.YAMLError as exc:
if verbose:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion tests3/data/a-nasty-libyaml-bug.loader-error

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/aliases.events

This file was deleted.

4 changes: 0 additions & 4 deletions tests3/data/bool.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/bool.detect

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/colon-in-flow-context.loader-error

This file was deleted.

7 changes: 0 additions & 7 deletions tests3/data/construct-bool.code

This file was deleted.

9 changes: 0 additions & 9 deletions tests3/data/construct-bool.data

This file was deleted.

10 changes: 0 additions & 10 deletions tests3/data/construct-custom.code

This file was deleted.

26 changes: 0 additions & 26 deletions tests3/data/construct-custom.data

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/construct-float.code

This file was deleted.

6 changes: 0 additions & 6 deletions tests3/data/construct-float.data

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/construct-int.code

This file was deleted.

6 changes: 0 additions & 6 deletions tests3/data/construct-int.data

This file was deleted.

6 changes: 0 additions & 6 deletions tests3/data/construct-map.code

This file was deleted.

6 changes: 0 additions & 6 deletions tests3/data/construct-map.data

This file was deleted.

10 changes: 0 additions & 10 deletions tests3/data/construct-merge.code

This file was deleted.

27 changes: 0 additions & 27 deletions tests3/data/construct-merge.data

This file was deleted.

13 changes: 0 additions & 13 deletions tests3/data/construct-null.code

This file was deleted.

18 changes: 0 additions & 18 deletions tests3/data/construct-null.data

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/construct-omap.code

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/construct-omap.data

This file was deleted.

9 changes: 0 additions & 9 deletions tests3/data/construct-pairs.code

This file was deleted.

7 changes: 0 additions & 7 deletions tests3/data/construct-pairs.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-bool.code

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-bool.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-complex.code

This file was deleted.

8 changes: 0 additions & 8 deletions tests3/data/construct-python-complex.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-float.code

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-float.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-int.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-long-short.code

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-name-module.code

This file was deleted.

5 changes: 0 additions & 5 deletions tests3/data/construct-python-name-module.data

This file was deleted.

1 change: 0 additions & 1 deletion tests3/data/construct-python-none.code

This file was deleted.

Loading

0 comments on commit d765a6c

Please sign in to comment.