diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 3ba43912..2a8b3d97 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -45,10 +45,10 @@ jobs: # python_tests requires optuna>=3.0.0 since it imports FloatDistribution run: | python -m pip install --progress-bar off --upgrade pip setuptools - pip install boto3 moto[s3] + pip install boto3 moto[s3] pytest pip install --progress-bar off "optuna>=3.0.0" pip install --progress-bar off . - - run: python -m unittest + - run: pytest python_tests test-with-optuna-master: runs-on: ubuntu-latest steps: @@ -61,7 +61,7 @@ jobs: - name: Install dependencies run: | python -m pip install --progress-bar off --upgrade pip setuptools - pip install boto3 moto[s3] + pip install boto3 moto[s3] pytest pip install --progress-bar off . python -m pip install --progress-bar off --upgrade git+https://github.com/optuna/optuna.git - - run: python -m unittest + - run: pytest python_tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 241c80d2..034b31cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ Note that `OPTUNA_DASHBOARD_DEBUG=1` makes the server will automatically restart #### Running Python unit tests ``` -$ python -m unittest +$ pytest python_tests/ ``` #### Running visual regression tests using pyppeteer diff --git a/pyproject.toml b/pyproject.toml index 406e0f49..be4a18e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,13 +64,14 @@ exclude = ''' | build | dist | venv + | node_modules )/ ''' [tool.isort] profile = 'black' -src_paths = ['optuna', 'tests', 'docs', 'benchmarks'] -skip_glob = ['docs/source/conf.py', '**/alembic/versions/*.py', 'tutorial/**/*.py'] +src_paths = ['optuna', 'python_tests', 'docs'] +skip_glob = ['docs/conf.py'] line_length = 99 lines_after_imports = 2 force_single_line = 'True' @@ -80,3 +81,9 @@ order_by_type = 'False' [tool.mypy] ignore_missing_imports = true disallow_untyped_defs = true + +[tool.pytest.ini_options] +addopts = "--color=yes" +markers = [ + "slow: marks tests as slow", +] diff --git a/requirements.txt b/requirements.txt index 25c37877..42be1ff1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ mypy-boto3-s3 mypy # unit test +pytest boto3 moto[s3]