Skip to content

Commit

Permalink
refactored python to a more sane starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Mar 30, 2013
1 parent c08e178 commit 51f967f
Show file tree
Hide file tree
Showing 39 changed files with 203 additions and 484 deletions.
73 changes: 0 additions & 73 deletions package/__init__.py

This file was deleted.

68 changes: 0 additions & 68 deletions package/errors.py

This file was deleted.

46 changes: 0 additions & 46 deletions package/info.py

This file was deleted.

31 changes: 0 additions & 31 deletions package/info.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions package/unittest.py

This file was deleted.

65 changes: 58 additions & 7 deletions setup.py
@@ -1,11 +1,62 @@
"""
This setup.py script was provided by the Python package package package.
import os, sys, glob
from distutils.core import Command

You can find the package info in ./package/info.py.
try:
from setuptools import setup
has_setuptools = True
except ImportError, err:
try:
from distutils.core import setup
except ImportError, err:
raise err

See http://pypi.python.org/pypi/package/ for more information.
"""
class Test(Command):
user_options = []
test_dir = 'tests'

import package
def initialize_options(self):
pass

package.setup()
def finalize_options(self):
pass

def run(self):
build_cmd = self.get_finalized_command('build')
build_cmd.run()
sys.path.insert(0, build_cmd.build_lib)
sys.path.insert(0, self.test_dir)
def exit(code):
pass
sys.exit = exit

for test in glob.glob(self.test_dir + '/test*.py'):
name = test[test.index('/') + 1: test.rindex('.')]
module = __import__(name)
if module.__dict__.get('unittest'):
module.unittest.main(module=module, argv=[''])

args = {
'author': 'Ingy dot Net',
'author_email': 'ingy@ingy.net',
'cmdclass': {
'test': Test,
},
'description': "C'Dent - A Portable Module Programming Language",
'install_requires': ['pyyaml'],
'name': 'testml',
# 'packages': [
# 'testml',
# 'testml.compiler',
# 'testml.compiler.pegex',
# 'testml.compiler.lite',
# 'testml.library',
# 'testml.library.debug',
# 'testml.library.standard',
# 'testml.runtime',
# 'testml.runtime.unit',
# 'testml.setup',
# ],
'url': 'http://www.testml.org/',
'version': '0.0.1',
}
setup(**args)
3 changes: 0 additions & 3 deletions t

This file was deleted.

49 changes: 45 additions & 4 deletions testml/__init__.py
@@ -1,5 +1,46 @@
__version__ = '0.0.1'
__version__ = '0.0.2'

class TestML():
def __init__(self, testml=None, bridge=None, compiler=None):
pass
from xxx import XXX

class TestML:
def __init__(self,
testml=None,
runtime=None,
bridge=None,
library=None,
compiler=None,
):
self.testml=testml
self.runtime=runtime
self.bridge=bridge
self.library=library
self.compiler=compiler
self.base='tests'

def run(self, testcase):
self.set_default_classes()
self.runtime(
compiler=self.compiler,
bridge=self.bridge,
library=self.library,
testml=self.testml,
base=self.base,
).run(testcase)

def set_default_classes(self):
if not self.runtime:
from testml.runtime.unit import Unit
self.runtime = Unit
if not self.compiler:
from testml.compiler.pegex import Pegex
self.compiler = Pegex
if not self.bridge:
from testml.bridge import Bridge
self.bridge = Bridge
if not self.library:
from testml.library.standard import Standard
from testml.library.debug import Debug
self.library = [
Standard,
Debug,
]
5 changes: 2 additions & 3 deletions testml/compiler/lite.py
@@ -1,5 +1,4 @@
from testml.compiler import Compiler
import testml.compiler

class Lite(Compiler):
class Lite(testml.compiler.Compiler):
pass

4 changes: 4 additions & 0 deletions testml/compiler/pegex.py
@@ -0,0 +1,4 @@
import testml.compiler

class Pegex(testml.compiler.Compiler):
pass
Empty file added testml/library/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions testml/library/debug.py
@@ -0,0 +1,2 @@
class Debug:
pass
2 changes: 2 additions & 0 deletions testml/library/standard.py
@@ -0,0 +1,2 @@
class Standard:
pass

0 comments on commit 51f967f

Please sign in to comment.