mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Move validate_solutions and add durations flag to pytest.ini (#3704)
* Move PE validate_solutions to scripts/ directory * Update pytest.ini file with durations settings * Remove codespell and autoblack workflow file * Dependent changes to test config files * Update pytest.ini
This commit is contained in:
parent
1cd8e68537
commit
b97529dd88
25
.github/workflows/autoblack.yml
vendored
25
.github/workflows/autoblack.yml
vendored
@ -1,25 +0,0 @@
|
|||||||
# GitHub Action that uses Black to reformat Python code (if needed) when doing a git push.
|
|
||||||
# If all Python code in the repo is compliant with Black then this Action does nothing.
|
|
||||||
# Otherwise, Black is run and its changes are committed to the repo.
|
|
||||||
# https://github.com/cclauss/autoblack
|
|
||||||
|
|
||||||
name: autoblack_push
|
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1 # Use v1, NOT v2
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
- run: pip install black isort
|
|
||||||
- run: black --check .
|
|
||||||
- name: If needed, commit black changes to a new pull request
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
black .
|
|
||||||
isort --profile black .
|
|
||||||
git config --global user.name github-actions
|
|
||||||
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
|
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
||||||
git commit -am "fixup! Format Python code with psf/black push"
|
|
||||||
git push --force origin HEAD:$GITHUB_REF
|
|
17
.github/workflows/codespell.yml
vendored
17
.github/workflows/codespell.yml
vendored
@ -1,17 +0,0 @@
|
|||||||
# GitHub Action to automate the identification of common misspellings in text files
|
|
||||||
# https://github.com/codespell-project/codespell
|
|
||||||
name: codespell
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
codespell:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
- run: pip install codespell
|
|
||||||
- run: |
|
|
||||||
SKIP="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_022/p022_names.txt"
|
|
||||||
codespell --ignore-words-list=ans,fo,followings,hist,iff,secant,som,tim --skip=$SKIP --quiet-level=2
|
|
||||||
- name: Codespell comment
|
|
||||||
if: ${{ failure() }}
|
|
||||||
uses: plettich/python_codespell_action@master
|
|
7
.github/workflows/project_euler.yml
vendored
7
.github/workflows/project_euler.yml
vendored
@ -1,9 +1,10 @@
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
# only check if a file is changed within the project_euler directory
|
# only check if a file is changed within the project_euler directory and related files
|
||||||
paths:
|
paths:
|
||||||
- 'project_euler/**'
|
- 'project_euler/**'
|
||||||
- '.github/workflows/project_euler.yml'
|
- '.github/workflows/project_euler.yml'
|
||||||
|
- 'scripts/validate_solutions.py'
|
||||||
|
|
||||||
name: 'Project Euler'
|
name: 'Project Euler'
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install --upgrade pytest pytest-cov
|
python -m pip install --upgrade pytest pytest-cov
|
||||||
- run: pytest --doctest-modules --durations=10 --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
|
- run: pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
|
||||||
validate-solutions:
|
validate-solutions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -27,4 +28,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install --upgrade pytest
|
python -m pip install --upgrade pytest
|
||||||
- run: pytest --durations=10 project_euler/validate_solutions.py
|
- run: pytest scripts/validate_solutions.py
|
||||||
|
@ -9,7 +9,7 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
install: pip install pytest-cov -r requirements.txt
|
install: pip install pytest-cov -r requirements.txt
|
||||||
script:
|
script:
|
||||||
- pytest --doctest-modules --ignore=project_euler/ --durations=10 --cov-report=term-missing:skip-covered --cov=. .
|
- pytest --doctest-modules --ignore=project_euler/ --cov-report=term-missing:skip-covered --cov=. .
|
||||||
after_success:
|
after_success:
|
||||||
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
|
- scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
|
||||||
notifications:
|
notifications:
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
[pytest]
|
[pytest]
|
||||||
markers =
|
markers =
|
||||||
mat_ops: mark a test as utilizing matrix operations.
|
mat_ops: mark a test as utilizing matrix operations.
|
||||||
|
addopts = --durations=10
|
||||||
|
@ -8,8 +8,8 @@ from typing import Dict, List
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
PROJECT_EULER_DIR_PATH = pathlib.Path.cwd().joinpath("project_euler")
|
PROJECT_EULER_DIR_PATH = pathlib.Path.cwd().joinpath("project_euler")
|
||||||
PROJECT_EULER_ANSWERS_PATH = PROJECT_EULER_DIR_PATH.joinpath(
|
PROJECT_EULER_ANSWERS_PATH = pathlib.Path.cwd().joinpath(
|
||||||
"project_euler_answers.json"
|
"scripts", "project_euler_answers.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
with open(PROJECT_EULER_ANSWERS_PATH) as file_handle:
|
with open(PROJECT_EULER_ANSWERS_PATH) as file_handle:
|
Loading…
Reference in New Issue
Block a user