Skip to content
Snippets Groups Projects
Commit 8dd96e15 authored by Henke's avatar Henke
Browse files

Fix issue #41

parent 9ffd4cfe
No related branches found
No related tags found
No related merge requests found
Pipeline #
from . import init, template, open, root, test_download, config, compile, test, run, \ from . import init, template, open, root, test_download, config, compile, test, run, \
submit, clean, tips submit, clean, tips, latest
...@@ -40,7 +40,7 @@ def _ListBuiltins(): ...@@ -40,7 +40,7 @@ def _ListBuiltins():
return [commands.init, commands.template, commands.open, commands.root, return [commands.init, commands.template, commands.open, commands.root,
commands.test_download, commands.config, commands.compile, commands.test_download, commands.config, commands.compile,
commands.test, commands.run, commands.submit, commands.clean, commands.test, commands.run, commands.submit, commands.clean,
commands.tips] commands.tips, commands.latest]
def _ListExternals(): def _ListExternals():
......
import os
from .util import WithMostModules, WithCustomCWD, ExecuteInOrder
@WithCustomCWD
@WithMostModules
def test_latest(bus):
home = os.environ['HOME']
problemname = 'carrots'
problemfolder = os.path.join(home, 'kattis', problemname)
calls = [
('kattcmd:init', 'kattcmd:init:directory-created'),
('kattcmd:open', 'kattcmd:open:problem-opened', [problemname]),
('kattcmd:template:python', 'kattcmd:template:python-added', [problemfolder])
]
assert all(checker.yay for _, checker in ExecuteInOrder(bus, calls))
result = bus.call('kattcmd:latest', bus, problemname)
assert len(result) == 2
type, items = result
assert type == 'python'
items = list(map(os.path.basename, items))
assert items == ['carrots.py']
...@@ -3,7 +3,8 @@ import tempfile ...@@ -3,7 +3,8 @@ import tempfile
from kattcmd import core from kattcmd import core
from kattcmd import bus as busmodule from kattcmd import bus as busmodule
from kattcmd.commands import open as open_command, compile as compile_command, \ from kattcmd.commands import open as open_command, compile as compile_command, \
init, root, config, template, test_download, test, run, clean, submit init, root, config, template, test_download, test, run, clean, submit, \
latest
def WithCustomCWD(f): def WithCustomCWD(f):
'''Descriptor for tests that should run in an isolated environment.''' '''Descriptor for tests that should run in an isolated environment.'''
...@@ -55,7 +56,7 @@ def WithModules(modulelist): ...@@ -55,7 +56,7 @@ def WithModules(modulelist):
def WithMostModules(f): def WithMostModules(f):
return WithModules([ return WithModules([
init, root, config, template, test_download, open_command, compile_command, test, init, root, config, template, test_download, open_command, compile_command, test,
run, clean, submit run, clean, submit, latest
])(f) ])(f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment