made app into a pip-installable package
This commit is contained in:
parent
6bd279f55b
commit
5c86b88bee
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
__pycache__/
|
||||
*.egg-info/
|
||||
build/
|
||||
|
19
LICENSE
Normal file
19
LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2023 dogeystamp <dogeystamp@disroot.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -6,4 +6,5 @@ testr is a script for running competitive programming test cases (for example fo
|
||||
|
||||
You can install all of these via Arch Linux's repositories:
|
||||
|
||||
- colorama
|
||||
- python-colorama
|
||||
- python
|
||||
|
26
pyproject.toml
Normal file
26
pyproject.toml
Normal file
@ -0,0 +1,26 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "gusty-testr"
|
||||
version = "0.0.1"
|
||||
authors = [
|
||||
{ name="dogeystamp", email="dogeystamp@disroot.org" }
|
||||
]
|
||||
description = "A test runner for competitive programming."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.7"
|
||||
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
"colorama > 0.4.0"
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
testr = "testr.cli:main"
|
@ -1,6 +1,5 @@
|
||||
import time
|
||||
from colorama import just_fix_windows_console, Fore, Style
|
||||
just_fix_windows_console()
|
||||
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
@ -8,29 +7,30 @@ from testr.file_data import DirectorySuite, ExecutableRunner
|
||||
from testr.runner import StatusCode, TestOptions
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
test_runner_group = parser.add_mutually_exclusive_group(required=True)
|
||||
test_data_group = parser.add_mutually_exclusive_group(required=True)
|
||||
async def run_cli():
|
||||
just_fix_windows_console()
|
||||
start_time = time.perf_counter()
|
||||
|
||||
test_data_group.add_argument("--testdir", help="Directory for test cases")
|
||||
test_runner_group.add_argument("--exec", help="Executable to run test cases against")
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("--timelim", help="Time limit in seconds", type=float, default=5.0)
|
||||
test_runner_group = parser.add_mutually_exclusive_group(required=True)
|
||||
test_data_group = parser.add_mutually_exclusive_group(required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
test_data_group.add_argument("--testdir", help="Directory for test cases")
|
||||
test_runner_group.add_argument("--exec", help="Executable to run test cases against")
|
||||
|
||||
parser.add_argument("--timelim", help="Time limit in seconds", type=float, default=5.0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
code_styles = {
|
||||
code_styles = {
|
||||
StatusCode.AC: Fore.GREEN,
|
||||
StatusCode.WA: Fore.RED,
|
||||
StatusCode.IR: Fore.YELLOW,
|
||||
StatusCode.TLE: Fore.YELLOW,
|
||||
}
|
||||
|
||||
|
||||
async def main():
|
||||
start_time = time.perf_counter()
|
||||
}
|
||||
|
||||
test_suite = DirectorySuite(Path(args.testdir))
|
||||
test_runner = ExecutableRunner(Path(args.exec))
|
||||
@ -64,5 +64,8 @@ async def main():
|
||||
print(f"\n Finished in{time.perf_counter() - start_time : .2f} seconds.\n")
|
||||
|
||||
|
||||
def main():
|
||||
asyncio.run(run_cli())
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
main()
|
Loading…
Reference in New Issue
Block a user