Skip to content

Commit

Permalink
Adjust a way to operate in "development" mode wrt. run-dev
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Pokorný <[email protected]>
  • Loading branch information
jnpkrn committed Sep 22, 2014
1 parent cd23454 commit 39a761f
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 33 deletions.
4 changes: 2 additions & 2 deletions __root__/doc/HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ Interactive/exploratory use: IPython and friends

For top-level modules, following prologue can be used:

import os.path as op; execfile(op.join('tests', '_bootstrap.py'))
execfile('_go')

or alternatively add this command-line option to ipython invocation:

ipython --InteractiveShellApp.exec_files='["tests/_bootstrap.py"]'
ipython --InteractiveShellApp.exec_files='["_go"]'

and from now on, one can use relative imports conveniently:

Expand Down
7 changes: 4 additions & 3 deletions __root__/run-dev
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ script_path = get_script_path()
real_script_path = realpath(script_path)


if __name__ != '__main__':
# when execfile'd from tests, verbose logging desired
if (basename(real_script_path) != basename(sys.path[0])
and 'LOGSKIP' not in globals()):
# when execfile'd from tests or so, verbose logging desired
from os import environ
import logging
logging.basicConfig()
Expand Down Expand Up @@ -61,7 +62,7 @@ if __package__ not in sys.modules:
sys.modules[__package__] = pkg

if __name__ == '__main__':
if basename(script_path) == 'run-dev':
if basename(real_script_path) == basename(sys.argv[0]): # __file__ undef?
from .main import run
sys.exit(run(sys.argv))

Expand Down
1 change: 1 addition & 0 deletions _go
1 change: 0 additions & 1 deletion tests/_bootstrap.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"


import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down
1 change: 1 addition & 0 deletions tests/_go
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/ccs2coroxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def test01(self):
print out_obj('bytestring')


import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
5 changes: 2 additions & 3 deletions tests/ccs2needle_xslt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing destilling XSLT from the sparse tree-organized snippets"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -41,5 +41,4 @@ def testXSLTTemplate2(self):
assert not isinstance(r, list)



execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing command"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -122,4 +122,4 @@ def cmd_chain_nonmatch_03(cmd_ctxt,
continue


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/command_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing command context"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -58,4 +58,4 @@ def testPreventedTaintTransitive(self):
self.assertTrue(ccb['a']['b'] == 43)


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/command_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing command manager"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand All @@ -32,4 +32,4 @@ def test_default(self):
self.assertEqual(cls, type(commands[cls.name]))


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing filter"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -67,4 +67,4 @@ def testXSLTTemplate(self):
self.assertTrue(ret == RESULT_DIRECT_XSLT)


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/filter_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing filter manager"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -94,4 +94,4 @@ def test_run_double_ccs2ccsflat(self):
norm_whitespace(f.read()))


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing format"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from os.path import dirname, join
Expand Down Expand Up @@ -93,4 +93,4 @@ def testRngExplicitValidationFail(self):
self.assertTrue(entries)


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/format_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing format manager"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -52,4 +52,4 @@ def test_injection(self):
self.assertEqual(fmt_cls, formats[fmt_id])


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing direct command run (e.g., when clufter used as a library)"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -72,4 +72,4 @@ def testCcs2PcsNeedleBetter(self):
#pprint(outputs['coro']['passout'])


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing utils module"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -40,4 +40,4 @@ def test_generator(self):
self.assertEqual(len(varnames), 2)


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/utils_cib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing CIB helpers"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand All @@ -25,4 +25,4 @@ def test_xsl_attrs_systemd(self):
self.assertTrue(rs.res_type == 'smb')


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))
4 changes: 2 additions & 2 deletions tests/utils_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""Testing XML helpers"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

import os.path as op; execfile(op.join(op.dirname(__file__), '_bootstrap.py'))
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))


from unittest import TestCase
Expand Down Expand Up @@ -34,4 +34,4 @@ def test_rng_pivot(self):
self.assertTrue(etree.tostring(et) == expected)


execfile(op.join(op.dirname(__file__), '_bootstart.py'))
from os.path import join, dirname as d; execfile(join(d(__file__), '_gone'))

0 comments on commit 39a761f

Please sign in to comment.