Skip to content

Commit

Permalink
fix(hansbug): try fix the problem in pytest && try make the test runn…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
HansBug committed Jan 3, 2022
1 parent 28dff7d commit a446a2f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 32 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ jobs:
strategy:
matrix:
python-version:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- 'pypy3'

steps:
- name: Checkout code
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
os:
- 'ubuntu-latest'
python-version:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- 'pypy3'
- 'pypy-3.6'
- 'pypy-3.8'
java-version:
- '8'
plantuml-server-version:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
PRIMARY_JAR_VERSION: ${{ matrix.plantuml-version }}
ASSISTANT_JAR_VERSION: ${{ matrix.assistant-plantuml-version }}
TEST_PLANTUML_HOST: http://localhost:18080
WORKERS: 4
TIMEOUT: '30'
run: |
source env.sh
make unittest WORKERS=${WORKERS}
Expand Down
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.PHONY: docs pdocs test unittest benchmark

WORKERS ?=
RERUN ?=
RERUN ?=
RERUN_DELAY ?=
TIMEOUT ?=

PROJ_DIR := $(shell readlink -f ${CURDIR})

Expand All @@ -13,12 +14,20 @@ RANGE_DIR ?= .
RANGE_TEST_DIR := ${TEST_DIR}/${RANGE_DIR}
RANGE_SRC_DIR := ${SRC_DIR}/${RANGE_DIR}

CI_DEFAULT_RERUNS := 5
CI_DEFAULT_RERUNS_DELAY := 10
DEFAULT_RERUNS := 3
DEFAULT_RERUNS_DELAY := 5
RERUNS ?= $(if ${CI},${CI_DEFAULT_RERUNS},${DEFAULT_RERUNS})
RERUNS_DELAY ?= $(if ${CI},${CI_DEFAULT_RERUNS_DELAY},${DEFAULT_RERUNS_DELAY})
CI_DEFAULT_RERUN := 5
LOCAL_DEFAULT_RERUN := 3
DEFAULT_RERUN ?= $(if ${CI},${CI_DEFAULT_RERUN},${LOCAL_DEFAULT_RERUN})
ACTUAL_RERUN := $(if ${RERUN},${RERUN},${DEFAULT_RERUN})

CI_DEFAULT_RERUN_DELAY := 10
LOCAL_DEFAULT_RERUN_DELAY := 5
DEFAULT_RERUN_DELAY ?= $(if ${CI},${CI_DEFAULT_RERUN_DELAY},${LOCAL_DEFAULT_RERUN_DELAY})
ACTUAL_RERUN_DELAY := $(if ${RERUN_DELAY},${RERUN_DELAY},${DEFAULT_RERUN_DELAY})

CI_DEFAULT_TIMEOUT := 30
LOCAL_DEFAULT_TIMEOUT := 15
DEFAULT_TIMEOUT ?= $(if ${CI},${CI_DEFAULT_TIMEOUT},${LOCAL_DEFAULT_TIMEOUT})
ACTUAL_TIMEOUT := $(if ${TIMEOUT},${TIMEOUT},${DEFAULT_TIMEOUT})

COV_TYPES ?= xml term-missing

Expand All @@ -30,14 +39,14 @@ unittest:
$(shell for type in ${COV_TYPES}; do echo "--cov-report=$$type"; done) \
--cov="${RANGE_SRC_DIR}" \
$(if ${MIN_COVERAGE},--cov-fail-under=${MIN_COVERAGE},) \
$(if ${WORKERS},-n ${WORKERS},) \
--durations=10 \
$(if ${CI}${RERUN},--reruns ${RERUNS} --reruns-delay ${RERUNS_DELAY},)
$(if ${CI}${ACTUAL_RERUN},--reruns ${ACTUAL_RERUN} --reruns-delay ${ACTUAL_RERUN_DELAY},) \
$(if ${ACTUAL_TIMEOUT},--timeout=${ACTUAL_TIMEOUT},)

benchmark:
pytest ${RANGE_TEST_DIR} -sv -m benchmark -n 1 --durations=0
pytest ${RANGE_TEST_DIR} -sv -m benchmark --durations=0

docs:
$(MAKE) -C "${DOC_DIR}" build
pdocs:
$(MAKE) -C "${DOC_DIR}" prod
$(MAKE) -C "${DOC_DIR}" prod
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ git clone https://github.com/HansBug/plantumlcli
cd plantumlcli && pip install .
```

Python 3.5+ is required, pypy is also tested to be okay.
Python 3.6+ is required, pypy is also tested to be okay.

## Using with cli

Expand Down
2 changes: 1 addition & 1 deletion requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sphinx~=3.2.0
sphinx_rtd_theme~=0.4.3
enum_tools
sphinx-toolbox
plantumlcli>=0.0.2
plantumlcli>=0.0.4
packaging
sphinx-multiversion~=0.2.4
where~=1.0.2
Expand Down
13 changes: 6 additions & 7 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
flake8~=3.5
pytest~=5.1
pytest-cov~=2.10
pytest-mock~=3.3
pytest-forked~=1.3
pytest-xdist~=1.31
pytest-rerunfailures~=9.0
more-itertools>=7,<8
pytest~=6.2.5
pytest-cov~=3.0.0
pytest-mock~=3.6.1
pytest-rerunfailures~=10.2
pytest-timeout~=2.0.2
more-itertools>=7,<8
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _load_req(file: str):
url='https://github.com/HansBug/plantumlcli',

# environment
python_requires=">=3.5",
python_requires=">=3.6",
install_requires=requirements,
tests_require=group_requirements['test'],
extras_require=group_requirements,
Expand All @@ -56,7 +56,6 @@ def _load_req(file: str):
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
2 changes: 1 addition & 1 deletion test/entrance/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def test_url_error(self):
assert result.exit_code != 0

@mark_select(_helloworld_condition)
def test_concurrency_error(self):
def test_concurrency(self):
runner = CliRunner()
result = runner.invoke(cli, args=['-u', '-n', '4', DEMO_HELLOWORLD_PUML, DEMO_HELLOWORLD_PUML,
DEMO_HELLOWORLD_PUML, DEMO_HELLOWORLD_PUML])
Expand Down

0 comments on commit a446a2f

Please sign in to comment.