-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
9,971 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
from .main import * | ||
from .main import _default_sigterm_handler | ||
|
||
from .command import * | ||
from .test import * |
112 changes: 112 additions & 0 deletions
112
external/skewer/example/python/plano/_testproject/.plano.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
from plano import * | ||
|
||
@command | ||
def base_command(alpha, beta, omega="x"): | ||
""" | ||
Base command help | ||
""" | ||
|
||
print("base", alpha, beta, omega) | ||
|
||
@command(name="extended-command", parent=base_command) | ||
def extended_command(alpha, beta, omega="y"): | ||
print("extended", alpha, omega) | ||
parent(alpha, beta, omega) | ||
|
||
@command(parameters=[CommandParameter("message_", help="The message to print", display_name="message"), | ||
CommandParameter("count", help="Print the message COUNT times"), | ||
CommandParameter("extra", default=1, short_option="e")]) | ||
def echo(message_, count=1, extra=None, trouble=False, verbose=False): | ||
""" | ||
Print a message to the console | ||
""" | ||
|
||
print("Echoing (message={}, count={})".format(message_, count)) | ||
|
||
if trouble: | ||
raise Exception("Trouble") | ||
|
||
for i in range(count): | ||
print(message_) | ||
|
||
@command | ||
def echoecho(message): | ||
echo(message) | ||
|
||
@command | ||
def haberdash(first, *middle, last="bowler"): | ||
""" | ||
Habberdash command help | ||
""" | ||
|
||
data = [first, *middle, last] | ||
write_json("haberdash.json", data) | ||
|
||
@command(parameters=[CommandParameter("optional", positional=True)]) | ||
def balderdash(required, optional="malarkey", other="rubbish", **extra_kwargs): | ||
""" | ||
Balderdash command help | ||
""" | ||
|
||
data = [required, optional, other] | ||
write_json("balderdash.json", data) | ||
|
||
@command | ||
def splasher(): | ||
write_json("splasher.json", [1]) | ||
|
||
@command | ||
def dasher(alpha, beta=123): | ||
pass | ||
|
||
@command(passthrough=True) | ||
def dancer(gamma, omega="abc", passthrough_args=[]): | ||
write_json("dancer.json", passthrough_args) | ||
|
||
# Vixen's parent calls prancer. We are testing to ensure the extended | ||
# prancer (below) is executed. | ||
|
||
from plano._tests import prancer, vixen | ||
|
||
@command(parent=prancer) | ||
def prancer(): | ||
parent() | ||
|
||
notice("Extended prancer") | ||
|
||
write_json("prancer.json", True) | ||
|
||
@command(parent=vixen) | ||
def vixen(): | ||
parent() | ||
|
||
@command | ||
def no_parent(): | ||
parent() | ||
|
||
@command(parameters=[CommandParameter("spinach")]) | ||
def feta(*args, **kwargs): | ||
write_json("feta.json", kwargs["spinach"]) | ||
|
||
@command(hidden=True) | ||
def invisible(something="nothing"): | ||
write_json("invisible.json", something) |
Empty file.
24 changes: 24 additions & 0 deletions
24
external/skewer/example/python/plano/_testproject/src/chucker/moretests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
from plano import * | ||
|
||
@test | ||
def hello_again(): | ||
print("Hello again") |
70 changes: 70 additions & 0 deletions
70
external/skewer/example/python/plano/_testproject/src/chucker/tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
from plano import * | ||
|
||
@test | ||
def hello(): | ||
print("Hello") | ||
|
||
@test | ||
async def hello_async(): | ||
print("Hello") | ||
|
||
@test | ||
def goodbye(): | ||
print("Goodbye") | ||
|
||
@test(disabled=True) | ||
def badbye(): | ||
print("Badbye") | ||
assert False | ||
|
||
@test(disabled=True) | ||
def skipped(): | ||
skip_test("Skipped") | ||
assert False | ||
|
||
@test(disabled=True) | ||
def keyboard_interrupt(): | ||
raise KeyboardInterrupt() | ||
|
||
@test(disabled=True, timeout=0.05) | ||
def timeout(): | ||
sleep(10, quiet=True) | ||
assert False | ||
|
||
@test(disabled=True) | ||
def process_error(): | ||
run("expr 1 / 0") | ||
|
||
@test(disabled=True) | ||
def system_exit_(): | ||
exit(1) | ||
|
||
def test_widget(message): | ||
print(message) | ||
|
||
for message in "hi", "lo", "in between": | ||
add_test(f"message-{message}", test_widget, message) | ||
|
||
@test(disabled=True) | ||
def badbye2(): | ||
print("Badbye 2") | ||
assert False |
Oops, something went wrong.