Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #215

Merged
merged 9 commits into from Nov 18, 2022
Merged

Test #215

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
@@ -1,5 +1,8 @@
[run]
branch = True
omit =
art/__main__.py
art/__init__.py

[report]
exclude_lines =
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Expand Up @@ -24,8 +24,6 @@ jobs:
python setup.py install
python -m art test
python -m art test2
python -m art testcov
python -m art testcov2
- name: Install dev-requirements
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -53,7 +51,7 @@ jobs:
if: matrix.python-version == 3.8
- name: Codecov
run: |
python -m art testcov2
coverage run -m art test2
codecov
if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest'
- name: Profile
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Test system modified
- `Python 3.11` added to `test.yml`
- `Conda-Forge` installing section added to `INSTALL.md`
### Removed
- `testcov` and `testcov2` modes
## [5.7] - 2022-07-06
### Added
- 5 new font
Expand Down
25 changes: 3 additions & 22 deletions art/__main__.py
@@ -1,16 +1,11 @@
# -*- coding: utf-8 -*-
"""Art main."""
from .art import *
from .art_param import FONT_MAP, ART_ENVIRONMENT_WARNING, FONT_ENVIRONMENT_WARNING, PACKAGE_LOAD_WARNING
from .art_param import FONT_MAP, ART_ENVIRONMENT_WARNING, FONT_ENVIRONMENT_WARNING
import sys
import doctest
import os
import zipfile
COVERAGE_INSTALL = True
try:
import coverage
except ImportError:
COVERAGE_INSTALL = False


def select_test(test_name="TEST"):
Expand All @@ -22,27 +17,17 @@ def select_test(test_name="TEST"):
:return: None
"""
error_flag_2 = 0
if test_name == "TESTCOV" or test_name == "TESTCOV2":
if COVERAGE_INSTALL:
cov = coverage.Coverage()
cov.start()
else:
print(PACKAGE_LOAD_WARNING)
error_flag_1 = doctest.testfile(
"test.py",
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
| doctest.IGNORE_EXCEPTION_DETAIL,
verbose=False)[0]
if test_name == "TESTCOV2" or test_name == "TEST2":
if test_name == "TEST2":
error_flag_2 = doctest.testfile(
"test2.py",
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL,
verbose=False)[0]
error_flag = error_flag_1 + error_flag_2
if (test_name == "TESTCOV" or test_name == "TESTCOV2") and COVERAGE_INSTALL:
cov.stop()
cov.report()
cov.save()
if error_flag == 0:
print("\n" + test_name + " Passed")
sys.exit(error_flag)
Expand All @@ -54,14 +39,10 @@ def select_test(test_name="TEST"):
if __name__ == "__main__":
args = sys.argv
if len(args) > 1:
if args[1].upper() == "TESTCOV":
select_test("TESTCOV")
elif args[1].upper() == "TEST":
if args[1].upper() == "TEST":
select_test("TEST")
elif args[1].upper() == "TEST2":
select_test("TEST2")
elif args[1].upper() == "TESTCOV2":
select_test("TESTCOV2")
elif args[1].upper() in ["LIST", "ARTS"]:
art_list()
elif args[1].upper() == "FONTS":
Expand Down
44 changes: 44 additions & 0 deletions art/test.py
Expand Up @@ -19,6 +19,46 @@
| '--------------' |
'----------------'
<BLANKLINE>
>>> tprint("\t\t2","block",sep=2)
<BLANKLINE>
.----------------.
| .--------------. |
| | _____ | |
| | / ___ `. | |
| | |_/___) | | |
| | .'____.' | |
| | / /____ | |
| | |_______| | |
| | | |
| '--------------' |
'----------------'
<BLANKLINE>
>>> tprint("\t\t2","block",sep="\n\n")
<BLANKLINE>
<BLANKLINE>
.----------------.
<BLANKLINE>
| .--------------. |
<BLANKLINE>
| | _____ | |
<BLANKLINE>
| | / ___ `. | |
<BLANKLINE>
| | |_/___) | | |
<BLANKLINE>
| | .'____.' | |
<BLANKLINE>
| | / /____ | |
<BLANKLINE>
| | |_______| | |
<BLANKLINE>
| | | |
<BLANKLINE>
| '--------------' |
<BLANKLINE>
'----------------'
<BLANKLINE>
<BLANKLINE>
>>> tprint(" ","block")
<BLANKLINE>
>>> tprint("123","alpha")
Expand Down Expand Up @@ -4600,6 +4640,10 @@
Traceback (most recent call last):
...
art.art.artError: The 'sep' type must be str.
>>> set_default(decoration=2)
Traceback (most recent call last):
...
art.art.artError: The 'decoration' type must be str.
>>> random.seed(200)
>>> Art = text2art("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~0123456789","rnd-small")
>>> random.seed(800)
Expand Down