Skip to content

Commit

Permalink
Pseudo-privatize tests (#334)
Browse files Browse the repository at this point in the history
* Pseudo-privatize tests

* Update references to path

* Update release history
  • Loading branch information
mattwthompson authored Apr 3, 2024
1 parent 8cb29f4 commit 0ca1eb4
Show file tree
Hide file tree
Showing 82 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
micromamba list
- name: Run Tests
run: python -m pytest -v --cov=openff --cov-config=setup.cfg openff/bespokefit/tests/ --cov-report=xml
run: python -m pytest -v --cov=openff --cov-config=setup.cfg openff/bespokefit/_tests/ --cov-report=xml

- name: Codecov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ jobs:
echo "Starting tests:"
PYTEST_ARGS=" -r fE --tb=short"
pytest $PYTEST_ARGS ../openff/bespokefit/tests/
pytest $PYTEST_ARGS ../openff/bespokefit/_tests/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pip install -e .
With this environment, tests can be run locally with [PyTest]:

```shell
pytest openff/bespokefit/tests
pytest openff/bespokefit/_tests
```

And documentation can be built with [Sphinx] and viewed in a web browser:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# Modules to exclude from API docs
"exclude_modules": [
"openff.bespokefit.cli",
"openff.bespokefit.tests",
"openff.bespokefit._tests",
]
}
autodoc_default_options = {
Expand Down
8 changes: 8 additions & 0 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Releases follow the ``major.minor.micro`` scheme recommended by

### New Features
* [#280] - Adds support for QCFractal 0.50 and newer [@mattwthompson] [@j-wags] [@ntBre]
* [#334] - Makes test pseudo-private [@mattwthompson]

### Documentation Updates
* [#321] - Documents how to download pre-computed QC data and add it to the local cache, which can avoid the need for local calculcations. by [@jthorton]
Expand Down Expand Up @@ -147,6 +148,13 @@ The first major release of bespokefit intended for public use.
[#272]: https://github.com/openforcefield/openff-bespokefit/pull/272
[#277]: https://github.com/openforcefield/openff-bespokefit/pull/277
[#279]: https://github.com/openforcefield/openff-bespokefit/pull/279
[#280]: https://github.com/openforcefield/openff-bespokefit/pull/280
[#286]: https://github.com/openforcefield/openff-bespokefit/pull/286
[#320]: https://github.com/openforcefield/openff-bespokefit/pull/320
[#321]: https://github.com/openforcefield/openff-bespokefit/pull/321
[#325]: https://github.com/openforcefield/openff-bespokefit/pull/325
[#330]: https://github.com/openforcefield/openff-bespokefit/pull/330
[#334]: https://github.com/openforcefield/openff-bespokefit/pull/334


[@Yoshanuikabundi]: https://github.com/Yoshanuikabundi
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import pytest
import rich

from openff.bespokefit._tests.executor import patch_settings
from openff.bespokefit.cli.executor.launch import launch_cli, validate_redis_connection
from openff.bespokefit.executor import BespokeExecutor
from openff.bespokefit.executor.utilities.redis import RedisNotConfiguredError
from openff.bespokefit.tests.executor import patch_settings


@pytest.fixture(scope="module", autouse=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from openff.toolkit.topology import Molecule
from openff.utilities import get_data_file_path

from openff.bespokefit._tests import does_not_raise
from openff.bespokefit.cli.executor.submit import (
_submit,
_submit_cli,
Expand All @@ -21,7 +22,6 @@
CoordinatorPOSTResponse,
)
from openff.bespokefit.schema.fitting import BespokeOptimizationSchema
from openff.bespokefit.tests import does_not_raise
from openff.bespokefit.workflows import BespokeWorkflowFactory


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from openff.qcsubmit.results import TorsionDriveResultCollection
from openff.utilities import get_data_file_path

from openff.bespokefit._tests import does_not_raise
from openff.bespokefit.cli.cache import (
_connect_to_qcfractal,
_results_from_file,
_update_from_qcsubmit_result,
update_cli,
)
from openff.bespokefit.tests import does_not_raise


@pytest.mark.parametrize(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from fastapi import FastAPI
from starlette.testclient import TestClient

from openff.bespokefit._tests.executor import patch_settings
from openff.bespokefit.executor.services.coordinator import app, worker
from openff.bespokefit.tests.executor import patch_settings


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from fastapi import FastAPI
from starlette.testclient import TestClient

from openff.bespokefit._tests.executor import patch_settings
from openff.bespokefit.executor.services.fragmenter import app, worker
from openff.bespokefit.tests.executor import patch_settings


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from celery.result import AsyncResult
from openff.fragmenter.fragment import Fragment, FragmentationResult, PfizerFragmenter

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_task
from openff.bespokefit.executor.services.fragmenter import worker
from openff.bespokefit.executor.services.fragmenter.models import (
FragmenterGETResponse,
FragmenterPOSTBody,
FragmenterPOSTResponse,
)
from openff.bespokefit.executor.utilities.depiction import IMAGE_UNAVAILABLE_SVG
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_task


def _mock_fragment(monkeypatch, status: str = "SUCCESS") -> FragmentationResult:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from openff.fragmenter.fragment import WBOFragmenter

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_task
from openff.bespokefit.executor.services.fragmenter import worker
from openff.bespokefit.executor.services.fragmenter.cache import (
cached_fragmentation_task,
)
from openff.bespokefit.executor.services.fragmenter.models import FragmenterPOSTBody
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_task


def test_cached_fragmentation_task(fragmenter_client, redis_connection, monkeypatch):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from fastapi import FastAPI
from starlette.testclient import TestClient

from openff.bespokefit._tests.executor import patch_settings
from openff.bespokefit.executor.services.optimizer import app, worker
from openff.bespokefit.tests.executor import patch_settings


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from celery.result import AsyncResult
from openff.fragmenter.fragment import WBOFragmenter

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_task
from openff.bespokefit.executor.services.optimizer import worker
from openff.bespokefit.executor.services.optimizer.models import (
OptimizerGETResponse,
Expand All @@ -12,7 +13,6 @@
OptimizationStageSchema,
)
from openff.bespokefit.schema.optimizers import ForceBalanceSchema
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_task


def test_get_optimize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from fastapi import FastAPI
from starlette.testclient import TestClient

from openff.bespokefit._tests.executor import patch_settings
from openff.bespokefit.executor.services.qcgenerator import app, worker
from openff.bespokefit.tests.executor import patch_settings


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
TorsionDriveResult,
)

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_task
from openff.bespokefit.executor.services.qcgenerator import worker
from openff.bespokefit.executor.services.qcgenerator.app import _retrieve_qc_result
from openff.bespokefit.executor.services.qcgenerator.cache import _canonicalize_task
Expand All @@ -22,7 +23,6 @@
)
from openff.bespokefit.executor.utilities.depiction import IMAGE_UNAVAILABLE_SVG
from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_task


@pytest.fixture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from openff.utilities import skip_if_missing
from qcelemental.models.common_models import Model

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_task
from openff.bespokefit.executor.services.qcgenerator import worker
from openff.bespokefit.executor.services.qcgenerator.cache import (
_canonicalize_task,
cached_compute_task,
)
from openff.bespokefit.schema.tasks import HessianTask, OptimizationTask, Torsion1DTask
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_task


@skip_if_missing("openeye.oechem")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import pytest
from celery import shared_task

from openff.bespokefit._tests.executor.mocking.celery import mock_celery_result
from openff.bespokefit.executor.utilities.celery import (
_spawn_worker,
configure_celery_app,
get_status,
get_task_information,
spawn_worker,
)
from openff.bespokefit.tests.executor.mocking.celery import mock_celery_result


@shared_task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import rich
from rich import pretty

from openff.bespokefit._tests import does_not_raise
from openff.bespokefit.executor.utilities import handle_common_errors
from openff.bespokefit.executor.utilities._utilities import ErrorState
from openff.bespokefit.tests import does_not_raise


def _raise(exception):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from openff.units import unit
from openff.utilities import get_data_file_path

from openff.bespokefit._tests import does_not_raise
from openff.bespokefit.exceptions import SMIRKSTypeError
from openff.bespokefit.schema.smirnoff import validate_smirks
from openff.bespokefit.tests import does_not_raise
from openff.bespokefit.utilities.smirks import (
SMIRKSGenerator,
compare_smirks_graphs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from openff.utilities import get_data_file_path, temporary_cd

from openff.bespokefit._pydantic import ValidationError
from openff.bespokefit._tests import does_not_raise
from openff.bespokefit.exceptions import (
MissingTorsionTargetSMARTS,
OptimizerError,
Expand All @@ -25,7 +26,6 @@
)
from openff.bespokefit.schema.targets import AbInitioTargetSchema
from openff.bespokefit.schema.tasks import Torsion1DTaskSpec
from openff.bespokefit.tests import does_not_raise
from openff.bespokefit.workflows.bespoke import (
_DEFAULT_ROTATABLE_SMIRKS,
BespokeWorkflowFactory,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[coverage:run]
omit =
*/tests/*
*/_tests/*
openff/bespokefit/_version.py

[coverage:report]
Expand Down

0 comments on commit 0ca1eb4

Please sign in to comment.