Commit 52ccc63f authored by Matt Traudt's avatar Matt Traudt
Browse files

Mass renaming of sbws.commands to sbws.core (tests pass again)

GH: ref #69
parent 6d5d39ce
sbws.commands package
sbws.core package
=====================
Submodules
----------
sbws.commands.client module
sbws.core.client module
---------------------------
.. automodule:: sbws.commands.client
.. automodule:: sbws.core.client
:members:
:undoc-members:
:show-inheritance:
sbws.commands.generate module
sbws.core.generate module
-----------------------------
.. automodule:: sbws.commands.generate
.. automodule:: sbws.core.generate
:members:
:undoc-members:
:show-inheritance:
sbws.commands.init module
sbws.core.init module
-------------------------
.. automodule:: sbws.commands.init
.. automodule:: sbws.core.init
:members:
:undoc-members:
:show-inheritance:
sbws.commands.server module
sbws.core.server module
---------------------------
.. automodule:: sbws.commands.server
.. automodule:: sbws.core.server
:members:
:undoc-members:
:show-inheritance:
sbws.commands.stats module
sbws.core.stats module
---------------------------
.. automodule:: sbws.commands.stats
.. automodule:: sbws.core.stats
:members:
:undoc-members:
:show-inheritance:
......@@ -49,7 +49,7 @@ sbws.commands.stats module
Module contents
---------------
.. automodule:: sbws.commands
.. automodule:: sbws.core
:members:
:undoc-members:
:show-inheritance:
......@@ -6,7 +6,7 @@ Subpackages
.. toctree::
sbws.commands
sbws.core
sbws.lib
sbws.util
......
import sbws.commands.cleanup
import sbws.commands.client
import sbws.commands.generate
import sbws.commands.init
import sbws.commands.pwgen
import sbws.commands.server
import sbws.commands.stats
import sbws.core.cleanup
import sbws.core.client
import sbws.core.generate
import sbws.core.init
import sbws.core.pwgen
import sbws.core.server
import sbws.core.stats
from sbws.util.config import get_config
from sbws.util.config import validate_config
from sbws.util.parser import create_parser
......@@ -50,19 +50,19 @@ def main():
def_args = [args, conf, log]
def_kwargs = {}
known_commands = {
'cleanup': {'f': sbws.commands.cleanup.main,
'cleanup': {'f': sbws.core.cleanup.main,
'a': def_args, 'kw': def_kwargs},
'client': {'f': sbws.commands.client.main,
'client': {'f': sbws.core.client.main,
'a': def_args, 'kw': def_kwargs},
'generate': {'f': sbws.commands.generate.main,
'generate': {'f': sbws.core.generate.main,
'a': def_args, 'kw': def_kwargs},
'init': {'f': sbws.commands.init.main,
'init': {'f': sbws.core.init.main,
'a': def_args, 'kw': def_kwargs},
'pwgen': {'f': sbws.commands.pwgen.main,
'pwgen': {'f': sbws.core.pwgen.main,
'a': def_args, 'kw': def_kwargs},
'server': {'f': sbws.commands.server.main,
'server': {'f': sbws.core.server.main,
'a': def_args, 'kw': def_kwargs},
'stats': {'f': sbws.commands.stats.main,
'stats': {'f': sbws.core.stats.main,
'a': def_args, 'kw': def_kwargs},
}
try:
......
import sbws.commands.cleanup
import sbws.commands.client
import sbws.commands.generate
import sbws.commands.init
import sbws.commands.pwgen
import sbws.commands.server
import sbws.commands.stats
import sbws.core.cleanup
import sbws.core.client
import sbws.core.generate
import sbws.core.init
import sbws.core.pwgen
import sbws.core.server
import sbws.core.stats
from sbws import version
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
......@@ -30,11 +30,11 @@ def create_parser():
p.add_argument('-d', '--directory', default=_default_dot_sbws_dname(),
help='Name of the .sbws directory')
sub = p.add_subparsers(dest='command')
sbws.commands.cleanup.gen_parser(sub)
sbws.commands.client.gen_parser(sub)
sbws.commands.generate.gen_parser(sub)
sbws.commands.init.gen_parser(sub)
sbws.commands.pwgen.gen_parser(sub)
sbws.commands.server.gen_parser(sub)
sbws.commands.stats.gen_parser(sub)
sbws.core.cleanup.gen_parser(sub)
sbws.core.client.gen_parser(sub)
sbws.core.generate.gen_parser(sub)
sbws.core.init.gen_parser(sub)
sbws.core.pwgen.gen_parser(sub)
sbws.core.server.gen_parser(sub)
sbws.core.stats.gen_parser(sub)
return p
from sbws import version
import sbws.commands.generate
import sbws.core.generate
from sbws.util.config import get_config
from sbws.lib.resultdump import load_recent_results_in_datadir
from sbws.lib.resultdump import ResultSuccess
......@@ -12,7 +12,7 @@ def test_generate_no_dotsbws(tmpdir, parser, log):
'-d {} -vvvv generate'.format(dotsbws).split())
conf = get_config(args, log.debug)
try:
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
except SystemExit as e:
assert e.code == 1
else:
......@@ -27,7 +27,7 @@ def test_generate_no_datadir(empty_dotsbws, parser, log):
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
try:
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
except SystemExit as e:
assert e.code == 1
else:
......@@ -44,7 +44,7 @@ def test_generate_bad_scale_constant(empty_dotsbws_datadir, parser, log):
.format(dotsbws.name).split())
conf = get_config(args, log.debug)
try:
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
except SystemExit as e:
assert e.code == 1
else:
......@@ -58,7 +58,7 @@ def test_generate_empty_datadir(empty_dotsbws_datadir, parser, log):
args = parser.parse_args(
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
log_lines = [l for l in log.test_get_logged_lines()]
assert 'No recent results' in log_lines[-1]
......@@ -68,7 +68,7 @@ def test_generate_single_error(dotsbws_error_result, parser, log):
args = parser.parse_args(
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
log_lines = [l for l in log.test_get_logged_lines()]
dd = conf['paths']['datadir']
for line in log_lines:
......@@ -86,7 +86,7 @@ def test_generate_single_success_noscale(dotsbws_success_result, parser, log,
args = parser.parse_args(
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
dd = conf['paths']['datadir']
results = load_recent_results_in_datadir(
1, dd, success_only=False, log_fn=log.debug)
......@@ -118,7 +118,7 @@ def test_generate_single_success_scale(dotsbws_success_result, parser, log,
args = parser.parse_args(
'-d {} -vvvv generate --scale'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
dd = conf['paths']['datadir']
results = load_recent_results_in_datadir(
1, dd, success_only=False, log_fn=log.debug)
......@@ -149,7 +149,7 @@ def test_generate_single_relay_success_noscale(
args = parser.parse_args(
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
dd = conf['paths']['datadir']
results = load_recent_results_in_datadir(
1, dd, success_only=False, log_fn=log.debug)
......@@ -182,7 +182,7 @@ def test_generate_single_relay_success_scale(
args = parser.parse_args(
'-d {} -vvvv generate --scale'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
dd = conf['paths']['datadir']
results = load_recent_results_in_datadir(
1, dd, success_only=False, log_fn=log.debug)
......@@ -213,7 +213,7 @@ def test_generate_two_relays_success_noscale(
args = parser.parse_args(
'-d {} -vvvv generate'.format(dotsbws.name).split())
conf = get_config(args, log.debug)
sbws.commands.generate.main(args, conf, log)
sbws.core.generate.main(args, conf, log)
dd = conf['paths']['datadir']
results = load_recent_results_in_datadir(
1, dd, success_only=False, log_fn=log.debug)
......
......@@ -4,8 +4,8 @@ from sbws.lib.resultdump import ResultError
from sbws.lib.resultdump import ResultSuccess
from sbws.lib.resultdump import Result
from sbws.lib.resultdump import write_result_to_datadir
import sbws.commands.init
import sbws.commands.stats
import sbws.core.init
import sbws.core.stats
from datetime import date
import os
import time
......@@ -15,7 +15,7 @@ def init_directory(dname, log):
p = create_parser()
args = p.parse_args('-d {} -vvvv init'.format(dname).split())
conf = get_config(args, log_fn=log.debug)
sbws.commands.init.main(args, conf, log)
sbws.core.init.main(args, conf, log)
def add_single_stale_result(dname):
......@@ -62,7 +62,7 @@ def test_stats_uninitted(tmpdir, log):
args = p.parse_args('-d {} -vvvv stats'.format(tmpdir).split())
conf = get_config(args, log_fn=log.debug)
try:
sbws.commands.stats.main(args, conf, log)
sbws.core.stats.main(args, conf, log)
except SystemExit as e:
assert e.code == 1
else:
......@@ -81,7 +81,7 @@ def test_stats_initted(tmpdir, log):
args = p.parse_args('-d {} -vvvv stats'.format(tmpdir).split())
conf = get_config(args, log_fn=log.debug)
try:
sbws.commands.stats.main(args, conf, log)
sbws.core.stats.main(args, conf, log)
except SystemExit as e:
assert e.code == 1
else:
......@@ -100,7 +100,7 @@ def test_stats_stale_result(tmpdir, log):
p = create_parser()
args = p.parse_args('-d {} -vvvv stats'.format(tmpdir).split())
conf = get_config(args, log_fn=log.debug)
sbws.commands.stats.main(args, conf, log)
sbws.core.stats.main(args, conf, log)
lines = [l for l in log.test_get_logged_lines()]
assert 'No fresh results' == lines[-1]
......@@ -116,7 +116,7 @@ def test_stats_fresh_result(tmpdir, capsys, log):
args = p.parse_args(
'-d {} -vvvv stats --error-types'.format(tmpdir).split())
conf = get_config(args, log_fn=log.debug)
sbws.commands.stats.main(args, conf, log)
sbws.core.stats.main(args, conf, log)
captured = capsys.readouterr()
lines = captured.out.strip().split('\n')
needed_output_lines = [
......@@ -147,7 +147,7 @@ def test_stats_fresh_results(tmpdir, capsys, log):
args = p.parse_args(
'-d {} -vvvv stats --error-types'.format(tmpdir).split())
conf = get_config(args, log_fn=log.debug)
sbws.commands.stats.main(args, conf, log)
sbws.core.stats.main(args, conf, log)
needed_output_lines = [
'1 relays have recent results',
'1 success results and 1 error results',
......
......@@ -4,7 +4,7 @@ from sbws.lib.resultdump import Result
from sbws.lib.resultdump import write_result_to_datadir
from sbws.util.config import get_config
from sbws.util.parser import create_parser
import sbws.commands.init
import sbws.core.init
from tempfile import TemporaryDirectory
import pytest
import os
......@@ -87,7 +87,7 @@ def empty_dotsbws(log, parser):
d = TemporaryDirectory()
args = parser.parse_args('-d {} -vvvv init'.format(d.name).split())
conf = get_config(args, log_fn=log.debug)
sbws.commands.init.main(args, conf, log)
sbws.core.init.main(args, conf, log)
return d
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment