Skip to content

Commit 63a1c06

Browse files
authored
Merge pull request #999 from MolSSI/test_clean
Some testing & other cleanup
2 parents 549eed7 + 37a19d3 commit 63a1c06

File tree

13 files changed

+45
-93
lines changed

13 files changed

+45
-93
lines changed

qcarchivetesting/qcarchivetesting/pytest_config.py renamed to conftest.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Contains testing infrastructure for QCFractal.
33
"""
44

5-
# This file is normally named conftest.py, but doing so
6-
# runs into issues with pytest automatically finding this, but also
7-
# having it be found through the pyproject.toml entry point
8-
95
import pytest
106

117

@@ -24,11 +20,6 @@ def pytest_addoption(parser):
2420

2521

2622
def pytest_collection_modifyitems(config, items):
27-
"""
28-
Handle test triggers based on the CLI flags
29-
Use decorators:
30-
@pytest.mark.slow
31-
"""
3223
runslow = config.getoption("--runslow")
3324

3425
skip_slow = pytest.mark.skip(reason="need --runslow option to run")

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[tool.black]
2+
line-length = 120
3+
4+
[tool.pytest.ini_options]
5+
markers = ["slow"]

qcarchivetesting/conda-envs/fulltest_server.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies:
2222
- pandas
2323
- pyjwt>=2.10.0
2424
- packaging
25-
- typing_extensions
2625
- python-dateutil
2726
- pytz
2827

qcarchivetesting/conda-envs/fulltest_snowflake.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies:
2222
- pandas
2323
- pyjwt>=2.10.0
2424
- packaging
25-
- typing_extensions
2625
- python-dateutil
2726
- pytz
2827

qcarchivetesting/conda-envs/fulltest_testing.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies:
2222
- pandas
2323
- pyjwt>=2.10.0
2424
- packaging
25-
- typing_extensions
2625
- python-dateutil
2726
- pytz
2827

qcarchivetesting/conda-envs/fulltest_worker.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies:
2020
- pandas
2121
- pyjwt>=2.10.0
2222
- packaging
23-
- typing_extensions
2423
- python-dateutil
2524
- pytz
2625

qcarchivetesting/pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,12 @@ dependencies = [
3636

3737
[project.entry-points.pytest11]
3838
qcarchive_fixtures = "qcarchivetesting.testing_fixtures"
39-
qcarchive_conftest = "qcarchivetesting.pytest_config"
4039

4140

4241
[tool.setuptools.package-data]
4342
qcarchivetesting = ["*_data/**", "config_files/**"]
4443

4544

46-
[tool.black]
47-
line-length = 120
48-
49-
5045
[tool.versioningit]
5146

5247

qcfractal/pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,12 @@ qcfractal-server = "qcfractal.qcfractal_server_cli:main"
6464
qcfractal = ["alembic.ini", "alembic/script.py.mako"]
6565

6666

67-
[tool.black]
68-
line-length = 120
69-
70-
7167
[tool.versioningit]
7268

7369

7470
[tool.versioningit.vcs]
7571
default-tag = "0.0.99" # useful for CI/shallow clones
7672

7773

78-
[tool.pytest.ini_options]
79-
markers = ["slow"]
80-
81-
8274
[tool.coverage.run]
8375
omit = ["qcfractal/alembic/*"]

qcfractal/qcfractal/qcfractal_server_cli.py

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -567,59 +567,6 @@ def server_upgrade_db(config):
567567
sys.exit(1)
568568

569569

570-
def server_upgrade_config(config_path):
571-
import secrets
572-
from qcfractal.old_config import OldFractalQCFConfig
573-
from qcfractal.config import convert_old_configuration
574-
575-
logger = logging.getLogger(__name__)
576-
577-
logger.info(f"Reading configuration data from {config_path}")
578-
with open(config_path, "r") as yf:
579-
file_data = yaml.safe_load(yf)
580-
581-
# Is this really an old config?
582-
if "fractal" not in file_data:
583-
logger.info(f"Configuration appears to be up-to-date")
584-
return
585-
586-
old_qcf_config = OldFractalQCFConfig(**file_data)
587-
new_qcf_config = convert_old_configuration(old_qcf_config)
588-
589-
# Move the old file out of the way
590-
base_backup_path = config_path + ".backup"
591-
backup_path = base_backup_path
592-
593-
# Find a suitable backup name. If the path exists,
594-
# add .1, .2, .3, etc, until it does
595-
i = 1
596-
while os.path.exists(backup_path):
597-
backup_path = base_backup_path + f".{i}"
598-
i += 1
599-
600-
logger.info(f"Moving original configuration to {backup_path}")
601-
shutil.move(config_path, backup_path)
602-
603-
# We strip out some stuff from the configuration, including things that were
604-
# set to the default
605-
new_qcf_config_dict = new_qcf_config.dict(skip_defaults=True)
606-
new_qcf_config_dict["database"].pop("base_folder")
607-
new_qcf_config_dict.pop("base_folder")
608-
609-
# Generate secret keys for the user. They can always change it later
610-
new_qcf_config_dict["api"]["secret_key"] = secrets.token_hex(24)
611-
new_qcf_config_dict["api"]["jwt_secret_key"] = secrets.token_hex(24)
612-
613-
logger.info(f"Writing new configuration data to {config_path}")
614-
with open(config_path, "w") as yf:
615-
yaml.dump(new_qcf_config_dict, yf)
616-
617-
logger.info("*" * 80)
618-
logger.info("Your configuration file has been upgraded, but will most likely need some fine tuning.")
619-
logger.info(f"Please edit {config_path} by hand. See the upgrade documentation for details.")
620-
logger.info("*" * 80)
621-
622-
623570
def server_user(args: argparse.Namespace, config: FractalConfig):
624571
user_command = args.user_command
625572

@@ -901,8 +848,7 @@ def main():
901848
if args.command == "upgrade-config":
902849
if args.config is None:
903850
raise RuntimeError("Configuration file path (--config) is required for upgrading configuration")
904-
server_upgrade_config(args.config)
905-
exit(0)
851+
raise RuntimeError("Upgrade configuration is not yet supported")
906852

907853
# Check for the config path on the command line. The command line
908854
# always overrides environment variables

qcfractalcompute/pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ qcfractal-compute-manager = "qcfractalcompute.compute_manager_cli:main"
4141
qcfractalcompute = ["run_scripts/**"]
4242

4343

44-
[tool.black]
45-
line-length = 120
46-
47-
4844
[tool.versioningit]
4945

5046

0 commit comments

Comments
 (0)