diff --git a/.codecov.yml b/.codecov.yml index 04dd65106..5a94096e2 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,34 +1,14 @@ -# codecov can find this file anywhere in the repo, so we don't need to clutter -# the root folder. -#comment: false - -codecov: - notify: - require_ci_to_pass: no - coverage: status: - patch: + project: # more options at https://docs.codecov.com/docs/commit-status default: - target: '70' - if_no_uploads: error - if_not_found: success - if_ci_failed: failure - project: - default: false - library: - target: auto - if_no_uploads: error - if_not_found: success - if_ci_failed: error - paths: '!*/tests/.*' - - tests: - target: 97.9% - paths: '*/tests/.*' - if_not_found: success - -flags: - tests: - paths: - - tests/ + target: auto # use the coverage from the base commit, fail if coverage is lower + threshold: 0% # allow the coverage to drop by + +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false # [true :: must have a base report to post] + require_head: false # [true :: must have a head report to post] + hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage] diff --git a/.codespell/ignore_lines.txt b/.codespell/ignore_lines.txt new file mode 100644 index 000000000..07fa7c8cd --- /dev/null +++ b/.codespell/ignore_lines.txt @@ -0,0 +1,2 @@ +;; Please include filenames and explanations for each ignored line. +;; See https://docs.openverse.org/meta/codespell.html for docs. diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt new file mode 100644 index 000000000..4775c6175 --- /dev/null +++ b/.codespell/ignore_words.txt @@ -0,0 +1,27 @@ +;; Please include explanations for each ignored word (lowercase). +;; See https://docs.openverse.org/meta/codespell.html for docs. + +;; abbreviation for "materials" often used in a journal title +mater + +;; alternative use of socioeconomic +socio-economic + +;; Frobenius norm used in np.linalg.norm +fro + +;; variable names +stati +convertor +dploy +pres +Ond + +;; package name +rever + +;; people.rst manually allows 'programer' as a variation of 'programmer' +programer + +;; suffix for dates +nd diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index f3cef15f4..000000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -source = - regolith -[report] -omit = - */python?.?/* - */site-packages/nose/* - # ignore _version.py and versioneer.py - .*version.* - *_version.py - -exclude_lines = - if __name__ == '__main__': diff --git a/.flake8 b/.flake8 index ce098e52f..2d2cb1688 100644 --- a/.flake8 +++ b/.flake8 @@ -6,8 +6,6 @@ exclude = dist, doc/source/conf.py max-line-length = 115 -# Ignore some style 'errors' produced while formatting by 'black' (see link below) +# Ignore some style 'errors' produced while formatting by 'black' # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings extend-ignore = E203 -per-file-ignores = - src/regolith/tests/test_helpers.py: E501 diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 936d6ee22..000000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -regolith/_version.py export-subst diff --git a/.github/ISSUE_TEMPLATE/release_checklist.md b/.github/ISSUE_TEMPLATE/release_checklist.md index a87a44a8b..b96c782de 100644 --- a/.github/ISSUE_TEMPLATE/release_checklist.md +++ b/.github/ISSUE_TEMPLATE/release_checklist.md @@ -13,10 +13,16 @@ assignees: "" - [ ] License information is verified as correct. If you are unsure, please comment below. - [ ] Locally rendered documentation contains all appropriate pages, including API references (check no modules are missing), tutorials, and other human written text is up-to-date with any changes in the code. -- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) are updated and - tested -- [ ] Successfully run any tutorial examples or do functional testing in some other way. +- [ ] Installation instructions in the README, documentation and on the website (e.g., diffpy.org) updated. +- [ ] Successfully run any tutorial examples or do functional testing with the latest Python version - [ ] Grammar and writing quality have been checked (no typos). Please mention @sbillinge when you are ready for release. Include any additional comments necessary, such as -version information and details about the pre-release. +version information and details about the pre-release here: + +### Post-release checklist + +Before closing this issue, please complete the following: + +- [ ] Run tutorial examples and conduct functional testing using the installation guide in the README. +- [ ] Documentation (README, tutorials, API references, and websites) is deployed without broken links or missing figures. diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml index e1239228a..a34cd38a1 100644 --- a/.github/workflows/check-news-item.yml +++ b/.github/workflows/check-news-item.yml @@ -6,7 +6,7 @@ on: - main jobs: - build: + check-news-item: uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 with: project: regolith diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 0f7f23447..000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build Documentation - -on: - push: - branches: - - main - release: - -jobs: - docs: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: build - auto-update-conda: true - - - name: install requirements - run: >- - conda install -n build -c conda-forge - --file requirements/build.txt - --file requirements/run.txt - --file requirements/docs.txt - --file requirements/pip.txt - --quiet --yes - - - name: install the package - run: python -m pip install . --no-deps - - - name: build documents - run: make -C doc html - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index cefb25c05..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: CI - -on: - push: - branches: - - main - - CI - pull_request: - workflow_dispatch: - -jobs: - miniconda: - name: Miniconda ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["ubuntu-latest"] - steps: - - name: check out regolith - uses: actions/checkout@v3 - with: - repository: regro/regolith - path: . - fetch-depth: 0 # avoid shallow clone with no tags - - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 - auto-activate-base: false - - - name: install regolith requirements - shell: bash -l {0} - run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test - conda install --file requirements/run.txt - conda install --file requirements/test.txt - pip install -r requirements/pip.txt - pip install . - - name: Validate regolith - shell: bash -l {0} - run: | - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml index 199fc0e29..085d5ee0a 100644 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -11,7 +11,7 @@ on: workflow_dispatch: jobs: - coverage: + matrix-coverage: uses: Billingegroup/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 with: project: regolith diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 99032cbdc..000000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - workflow_dispatch: - -jobs: - pre-commit: - # pull requests are a duplicate of a branch push if within the same repo. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - - uses: pre-commit/action@v3.0.0 - with: - extra_args: --all-files - env: - CI: true diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml index f1802421a..75d60190d 100644 --- a/.github/workflows/tests-on-pr.yml +++ b/.github/workflows/tests-on-pr.yml @@ -4,13 +4,57 @@ on: push: branches: - main + - cookie pull_request: workflow_dispatch: jobs: validate: - uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 - with: - project: regolith - c_extension: false - headless: false + defaults: + run: + shell: bash -l {0} + + runs-on: ubuntu-latest + steps: + - name: Check out regolith repository + uses: actions/checkout@v4 + + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: test + auto-update-conda: true + environment-file: environment.yml + auto-activate-base: false + python-version: 3.11 + + - name: Conda config + run: >- + conda config --set always_yes yes + --set changeps1 no + + - name: Install libgtk for Linux + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev + + - name: Install regolith and requirements + run: | + conda install --file requirements/test.txt + conda install --file requirements/conda.txt + pip install gooey + python -m pip install . --no-deps + + + - name: Validate regolith + run: | + pytest --cov + coverage report -m + codecov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + verbose: true + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3070e1996..4344aeba1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,7 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace + exclude: '\.(rst|txt)$' - id: check-case-conflict - id: check-merge-conflict - id: check-toml @@ -28,6 +29,7 @@ repos: rev: 7.0.0 hooks: - id: flake8 + exclude: ^tests/test_helpers.py$|^tests/test_commands.py$ - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: @@ -44,3 +46,9 @@ repos: name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4a3e40743..9b7b3aa9f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -54,16 +54,16 @@ v0.8.0 **Added:** -* the option to specify a different database for the expense and presentation +* the option to specify a different database for the expense and presentation items when running a_presentation. * scripts (profile_regolith and profile_helper_gui) that run regolith and helper_gui with the python cProfiler. Used for debugging and code development. * universally unique IDs added to all tasks, and now listed by todo lister * milestone lister now prints the uuids of the milestones * additional tests for c+p, annual-activity and grant-report builders -* repo_info_complete in tools to check the existence of remote repositories before operating on them - * token_info_complete in tools to check for the existence of the user's private API authentication token +* repo_info_complete in tools to check the existence of remote repositories before operating on them + * token_info_complete in tools to check for the existence of the user's private API authentication token * create_repo in tools to create a repository in a given remote repository - * functionality to presentation helper that creates a repo by calling on create_repo function in tools when no_talk_repo box is not checked + * functionality to presentation helper that creates a repo by calling on create_repo function in tools when no_talk_repo box is not checked * no_repo box/option added to presentation helper gui * no_in_cv option for employment entries that they don't appear in cv's and resumes * get_appointments() function @@ -106,11 +106,11 @@ v0.8.0 using the tags field for each paper * tests of tex and html files now compare outputs line by line and ignore variables paths that have proven to be unstable -* Standardized CLI option names by replacing the underscore with a hyphen in the - following: --end_date, --begin_-date, --submitted_date, --no_cal, --due_date, - --group_members, --other_agencies, --months_academic, --months_summer, - --assigned_to, --assigned_by, --loc_inst, --kv_filter, --return_fields, - --helper_help, --school_aka, --school_name, --school-id, --dept_aka, --dept_name, +* Standardized CLI option names by replacing the underscore with a hyphen in the + following: --end_date, --begin_-date, --submitted_date, --no_cal, --due_date, + --group_members, --other_agencies, --months_academic, --months_summer, + --assigned_to, --assigned_by, --loc_inst, --kv_filter, --return_fields, + --helper_help, --school_aka, --school_name, --school-id, --dept_aka, --dept_name, --dept_id, --estimated_duration. * Reformatted printing of todos to make the order clearer * "--projectum_id" has been changed from a required arg to an optional arg @@ -314,7 +314,7 @@ v0.3.1 **Changed:** -* ``open`` uses explict 'utf-8' bindings (for windows users) +* ``open`` uses explicit 'utf-8' bindings (for windows users) * Allow education to be ongoing * Allow begin and end years for service * Make employment optional @@ -434,7 +434,7 @@ v0.2.0 * Error in ``BaseBuilder`` which caused it to look in the wrong spot for templates -* Fixed bug in grad builder when the total wieght is zero. +* Fixed bug in grad builder when the total weight is zero. * Actually use ``ChainedDB`` when working with the DBs * Error in ``ChainedDB`` which caused bad keys to return with ``None`` @@ -465,7 +465,7 @@ v0.1.10 **Changed:** -* ``CVBuilder`` and ``ResumeBuilder`` builders now inheret from ``LatexBuilderBase`` +* ``CVBuilder`` and ``ResumeBuilder`` builders now inherit from ``LatexBuilderBase`` **Fixed:** diff --git a/README.rst b/README.rst index 79a66604a..a7f5cbd60 100644 --- a/README.rst +++ b/README.rst @@ -120,7 +120,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct `_. +Before contributing, please read our `Code of Conduct `_. Contact ------- diff --git a/doc/source/collections/beamplan.rst b/doc/source/collections/beamplan.rst index f381656d7..c9829139e 100644 --- a/doc/source/collections/beamplan.rst +++ b/doc/source/collections/beamplan.rst @@ -57,7 +57,7 @@ YAML Example exp_plan: - load samples on the holder - scan the holder to locate the samples - - take room temperature measurement of sample and the subtrate + - take room temperature measurement of sample and the substrate - ramp down temperature to 100K - ramp up, measure PDF at temperature 100K ~ 300K, 10K stepsize, 1 min exposure holder: film holder (1 cm * 1 cm * 1 mm) @@ -70,7 +70,7 @@ YAML Example project_lead: kseth samples: - WO3 film - - glass subtrate + - glass substrate scanplan: - Scanplan(bt, Tramp, 30, 80, 500, 10) ship_plan: @@ -97,7 +97,7 @@ JSON/Mongo Example "exp_plan": [ "load samples on the holder", "scan the holder to locate the samples", - "take room temperature measurement of sample and the subtrate", + "take room temperature measurement of sample and the substrate", "ramp down temperature to 100K", "ramp up, measure PDF at temperature 100K ~ 300K, 10K stepsize, 1 min exposure" ], @@ -112,7 +112,7 @@ JSON/Mongo Example "project_lead": "kseth", "samples": [ "WO3 film", - "glass subtrate" + "glass substrate" ], "scanplan": [ "Scanplan(bt, Tramp, 30, 80, 500, 10)" diff --git a/doc/source/collections/expenses.rst b/doc/source/collections/expenses.rst index 008b47755..9e6119270 100644 --- a/doc/source/collections/expenses.rst +++ b/doc/source/collections/expenses.rst @@ -16,7 +16,7 @@ The following lists key names mapped to its type and meaning for each entry. :end_month: ['string', 'integer'], The month when the travel/business end, optional :end_year: integer, The year when the travel/business end, optional - Allowed values: + Allowed values: * travel * business :grant_percentages: list, the percentage of the reimbursement amount to put on each grant. This list must be the same length asthe grants list and the percentages placed in the order that the grants appear in that list, optional @@ -55,7 +55,7 @@ The following lists key names mapped to its type and meaning for each entry. :where: string, where the reimbursement has been sent, optional :status: string, The status of the expense, optional - Allowed values: + Allowed values: * unsubmitted * submitted * reimbursed diff --git a/doc/source/collections/grants.rst b/doc/source/collections/grants.rst index 78609cfb0..d489d4259 100644 --- a/doc/source/collections/grants.rst +++ b/doc/source/collections/grants.rst @@ -58,7 +58,7 @@ The following lists key names mapped to its type and meaning for each entry. :scope: string, The scope of the grant, answers the prompt: Describe Research Including Synergies and Delineation with Respect to this Proposal/Award:, optional :status: string, status of the grant, optional - Allowed values: + Allowed values: * pending * declined * accepted @@ -73,7 +73,7 @@ The following lists key names mapped to its type and meaning for each entry. :name: string, optional :position: string, optional - Allowed values: + Allowed values: * pi * copi :subaward_amount: ['integer', 'float'], optional diff --git a/doc/source/collections/people.rst b/doc/source/collections/people.rst index 77625fb56..bd1183bff 100644 --- a/doc/source/collections/people.rst +++ b/doc/source/collections/people.rst @@ -15,7 +15,7 @@ The following lists key names mapped to its type and meaning for each entry. :day: integer, the day the activity took place, optional :type: string, the type of the activity, optional - Allowed values: + Allowed values: * teaching * research :month: ['integer', 'string'], the month the activity took place, optional @@ -40,14 +40,14 @@ The following lists key names mapped to its type and meaning for each entry. :unit: string, name of department or school etc., optional :type: string, type of committee, department, school, university, external, optional - Allowed values: + Allowed values: * phdoral * phddefense * phdproposal * promotion :level: string, department or school or university, or external, optional - Allowed values: + Allowed values: * department * school * university @@ -94,7 +94,7 @@ The following lists key names mapped to its type and meaning for each entry. :permanent: boolean, true if the position is open ended and has no fixed end-date, optional :position: string, optional - Allowed values: + Allowed values: * ``''`` * editor * unknown @@ -142,7 +142,7 @@ The following lists key names mapped to its type and meaning for each entry. :position_full: string, The full on title of the position. This will be typeset if it is here, or if not Position will be used. Position will be used for sorting and must come from a fixed list of positions, optional :status: string, optional - Allowed values: + Allowed values: * pi * adjunct * high-school @@ -161,7 +161,7 @@ The following lists key names mapped to its type and meaning for each entry. :end_day: integer, the day facility started, optional :type: string, the type of the facility. Columbia asksfor wished-for facilities, so there are teaching-wish and research-wish fields., optional - Allowed values: + Allowed values: * teaching * research * shared @@ -236,7 +236,7 @@ The following lists key names mapped to its type and meaning for each entry. :orcid_id: string, The ORCID ID of the person, optional :position: string, such as professor, graduate student, or scientist, optional - Allowed values: + Allowed values: * ``''`` * editor * unknown @@ -288,7 +288,7 @@ The following lists key names mapped to its type and meaning for each entry. :type: string, optional - Allowed values: + Allowed values: * online * article :topic: string, The short sentence of what the publicity was about, optional @@ -332,7 +332,7 @@ The following lists key names mapped to its type and meaning for each entry. :other: ['string', 'list'], optional :type: string, profession, department, school, university, optional - Allowed values: + Allowed values: * profession * university * school diff --git a/doc/source/collections/presentations.rst b/doc/source/collections/presentations.rst index 3e6934d0e..202c9e01d 100644 --- a/doc/source/collections/presentations.rst +++ b/doc/source/collections/presentations.rst @@ -26,7 +26,7 @@ The following lists key names mapped to its type and meaning for each entry. :project: ['string', 'list'], project or list of projects that this presentation is associated with. Should be discoverable in projects collection, optional :status: string, Is the application in prep or submitted, was the invitation accepted or declined, was the trip cancelled?, required - Allowed values: + Allowed values: * in-prep * submitted * accepted @@ -36,7 +36,7 @@ The following lists key names mapped to its type and meaning for each entry. :title: string, title of the presentation, required :type: string, type of presentation, required - Allowed values: + Allowed values: * award * colloquium * contributed_oral diff --git a/doc/source/collections/projecta.rst b/doc/source/collections/projecta.rst index 498fda8ed..686b0d2b7 100644 --- a/doc/source/collections/projecta.rst +++ b/doc/source/collections/projecta.rst @@ -20,7 +20,7 @@ The following lists key names mapped to its type and meaning for each entry. :notes: list, any notes about the deliverable that we want to keep track of, optional :status: string, status of the deliverable. Allowed values are {', '.join(PROJECTUM_STATI)}, optional - Allowed values: + Allowed values: * proposed * converged * started @@ -45,7 +45,7 @@ The following lists key names mapped to its type and meaning for each entry. :notes: list, any notes about the kickoff, optional :status: string, status of the kickoff. Allowed values are {', '.join(PROJECTUM_STATI)}, optional - Allowed values: + Allowed values: * proposed * converged * started @@ -56,7 +56,7 @@ The following lists key names mapped to its type and meaning for each entry. * all :type: string, type of kickoff deliverable. In general will be 'meeting'Allowed values are {', '.join(MILESTONE_TYPES)}, optional - Allowed values: + Allowed values: * mergedpr * meeting * other @@ -92,7 +92,7 @@ The following lists key names mapped to its type and meaning for each entry. :audience: list, list of people attending the meeting.Normally this list is group_members, collaborators, and pi, or some subset of these. if people are invited who are not alreadyin these groups their names or id's can be added explicitly to the list, optional :status: string, status of the milestone. Allowed values are {', '.join(PROJECTUM_STATI)}, optional - Allowed values: + Allowed values: * proposed * converged * started @@ -103,7 +103,7 @@ The following lists key names mapped to its type and meaning for each entry. * all :type: string, type of milestone deliverable. Allowed values are {', '.join(MILESTONE_TYPES)}, optional - Allowed values: + Allowed values: * mergedpr * meeting * other @@ -128,7 +128,7 @@ The following lists key names mapped to its type and meaning for each entry. :product_url: string, url for manuscript or code repository, optional :status: string, status of the projectum. Allowed values are {', '.join(PROJECTUM_STATI)}, required - Allowed values: + Allowed values: * proposed * converged * started diff --git a/doc/source/collections/projects.rst b/doc/source/collections/projects.rst index cdc29d447..e15d7466b 100644 --- a/doc/source/collections/projects.rst +++ b/doc/source/collections/projects.rst @@ -38,7 +38,7 @@ The following lists key names mapped to its type and meaning for each entry. :position: string, optional :type: ['string'], The type of project, optional - Allowed values: + Allowed values: * ossoftware * funded * outreach diff --git a/doc/source/collections/proposalReviews.rst b/doc/source/collections/proposalReviews.rst index b0967351e..1bae40e8a 100644 --- a/doc/source/collections/proposalReviews.rst +++ b/doc/source/collections/proposalReviews.rst @@ -10,7 +10,7 @@ The following lists key names mapped to its type and meaning for each entry. :adequacy_of_resources: list, Are the resources of the PI adequate, required :agency: string, currently nsf, doe or other, optional - Allowed values: + Allowed values: * nsf * doe * other @@ -36,7 +36,7 @@ The following lists key names mapped to its type and meaning for each entry. :reviewer: string, short name of the reviewer. Will be used in the filename of the resulting text file, required :status: string, the status of the review, optional - Allowed values: + Allowed values: * invited * accepted * declined diff --git a/doc/source/collections/proposals.rst b/doc/source/collections/proposals.rst index 8d3acba0b..8fccf078d 100644 --- a/doc/source/collections/proposals.rst +++ b/doc/source/collections/proposals.rst @@ -37,7 +37,7 @@ The following lists key names mapped to its type and meaning for each entry. :pre: dict, Information about the pre-proposal, optional :status: string, e.g. 'pending', 'accepted', 'declined', required - Allowed values: + Allowed values: * pending * declined * accepted diff --git a/doc/source/collections/refereeReports.rst b/doc/source/collections/refereeReports.rst index 66f92f424..084add77c 100644 --- a/doc/source/collections/refereeReports.rst +++ b/doc/source/collections/refereeReports.rst @@ -31,7 +31,7 @@ The following lists key names mapped to its type and meaning for each entry. :month: ['integer', 'string'], The month the review was requested, optional :recommendation: string, Your publication recommendation, required - Allowed values: + Allowed values: * reject * asis * smalledits @@ -41,7 +41,7 @@ The following lists key names mapped to its type and meaning for each entry. :reviewer: string, name of person reviewing the paper, required :status: string, Where you are with the review, required - Allowed values: + Allowed values: * invited * accepted * declined diff --git a/doc/source/collections/todos.rst b/doc/source/collections/todos.rst index 5aba00708..8f00be90d 100644 --- a/doc/source/collections/todos.rst +++ b/doc/source/collections/todos.rst @@ -22,7 +22,7 @@ The following lists key names mapped to its type and meaning for each entry. :importance: integer, the importance, from 0 to 3, optional :status: string, the status: started/finished/cancelled, optional - Allowed values: + Allowed values: * started * finished * cancelled diff --git a/doc/source/commands/build.rst b/doc/source/commands/build.rst index a518ff486..f7238c3c4 100644 --- a/doc/source/commands/build.rst +++ b/doc/source/commands/build.rst @@ -10,7 +10,7 @@ build build_targets [build_targets ...] positional arguments: - build_targets targets to build. Currently valid targets are: + build_targets targets to build. Currently valid targets are: ['annual-activity', 'beamplan', 'current-pending', 'cv', 'figure', 'formalletter', 'grade', 'grades', 'grant-report', 'html', 'internalhtml', 'postdocad', 'preslist', 'publist', 'reading-lists', 'reimb', 'recent-collabs', 'resume', 'review-man', 'review-prop'] options: diff --git a/doc/source/commands/classlist.rst b/doc/source/commands/classlist.rst index dfd908d45..a3cfad87e 100644 --- a/doc/source/commands/classlist.rst +++ b/doc/source/commands/classlist.rst @@ -7,7 +7,7 @@ classlist op filename course_id positional arguments: - op operatation to perform, such as "add" or "replace". + op operation to perform, such as "add" or "replace". filename file to read class information from. course_id course identifier whose registry should be updated diff --git a/doc/source/commands/ingest.rst b/doc/source/commands/ingest.rst index a0e8b6bb3..4d08da493 100644 --- a/doc/source/commands/ingest.rst +++ b/doc/source/commands/ingest.rst @@ -11,5 +11,5 @@ ingest options: -h, --help show this help message and exit - --coll COLL collection name, if this is not given it is infered from the + --coll COLL collection name, if this is not given it is inferred from the file type or file name. diff --git a/doc/source/database_maintenance/mongo_maintenance.rst b/doc/source/database_maintenance/mongo_maintenance.rst index 9422739af..9c23aa55b 100644 --- a/doc/source/database_maintenance/mongo_maintenance.rst +++ b/doc/source/database_maintenance/mongo_maintenance.rst @@ -47,7 +47,7 @@ Setting Up a Server **LOCAL** | Your local server is automatically running as a service on localhost if you have downloaded the community version of - mongodb correctly. **Congradulations!** + mongodb correctly. **Congratulations!** | Accessing your local mongodb server **for administrative purposes** can be done simply by typing "mongo" into your terminal, which opens the mongodb shell. By default, you will have three databases present (admin, config, local). diff --git a/doc/source/index.rst b/doc/source/index.rst index 26407ead7..1d3491e09 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -13,8 +13,12 @@ -Regolith -======== +####### +|title| +####### + +.. |title| replace:: regolith documentation + Regolith is a content management system for software & research groups. Regolith creates and manages a database of people, publications, projects, proposals & grants, courses, and more! From this database, regolith is then @@ -28,6 +32,22 @@ Databases may be file-based (JSON and YAML) or MongoDB-based. Regolith is developed as a `regro project `_ +| Software version |release|. +| Last updated |today|. + +======= +Authors +======= + +regolith was mostly written by Anthony Scopatz, with significant contributions +from CJ Wright. More recently development has been led By simon Billinge and +regolith is currently developed by the Billinge Group +and its community contributors. + +For a detailed list of contributors see +https://github.com/regro/regolith/graphs/contributors. + +============= Example Sites ============= The following are some sample websites that are powered by regolith, even though @@ -37,6 +57,7 @@ websites is just one of the many facets of this tool: 1. `ERGS Home Page `_ 2. `Technical WorkShop on Fuel Cycle Simulation `_ +============ Installation ============ 1. Make your first database @@ -140,7 +161,7 @@ listing, or open a file browser such as windows explorer and check out what is in there. -You will see a direcotry called :bash:`db` and a file called :bash:`regolithrc.json`. +You will see a directory called :bash:`db` and a file called :bash:`regolithrc.json`. All of the collections in your database are in the :bash:`db` directory. The :bash:`regolithrc.json` contains a bunch of information that Regolith needs to run and do its business. @@ -509,7 +530,7 @@ on a GitLab instance. "repos":[ {"_id": "talk_repo", # a_presentation looks for the entry with this ID "params": {"namespace_id": "35", # These params are handed to the API post request. - "initialize_with_readme": "True" # "name" is also needed but a_presentation generates that automatially + "initialize_with_readme": "True" # "name" is also needed but a_presentation generates that automatically }, "url": "https://gitlab.example.com", # The URL of the main GitLab/GitHub instance "api_route": "/api/v4/projects/", # This is the route to the REST-API. The value @@ -702,20 +723,35 @@ For those who want to dive deeper into the library itself. api/regolith +================= +Table of contents +================= +.. toctree:: + :titlesonly: + + license + release + Package API Regolith Commands ================= -Shell commmands for regolith +Shell commands for regolith .. toctree:: :maxdepth: 2 commands/index - Database Maintenance ========= .. toctree:: :maxdepth: 1 database_maintenance/index + +======= +Indices +======= + +* :ref:`genindex` +* :ref:`search` diff --git a/doc/source/rc.rst b/doc/source/rc.rst index d03125964..665db3aec 100644 --- a/doc/source/rc.rst +++ b/doc/source/rc.rst @@ -15,12 +15,12 @@ The temporary location to build whatever it is needs building. ``mongodbpath`` ================ The value to pass into the ``--dbpath`` option to ``mongod``. Defaults to ``'${builddir}/_dbpath'`` -if unspecified. +if unspecified. ``databases`` =============== -This represents the public or private databases that are used to store unstructured data about the group +This represents the public or private databases that are used to store unstructured data about the group and its activities. .. code-block:: python @@ -39,7 +39,7 @@ and its activities. ``stores`` =============== -This is used to represent connection information to document stores, think PDFs, images, etc. +This is used to represent connection information to document stores, think PDFs, images, etc. .. code-block:: python @@ -60,7 +60,7 @@ This is a string of the research group name. ``cname`` ============ -This is a string of the CNAME value. This will be put into a file called CNAME in the root +This is a string of the CNAME value. This will be put into a file called CNAME in the root HTML build dir, if it is present. @@ -83,7 +83,7 @@ This is a list of deployment targets to send information to from the build direc ``deploydir`` ====================== -The temporary location to for all deployment directories. If not present, this +The temporary location to for all deployment directories. If not present, this will default to a ``deploy`` dir inside of the ``builddir`` .. code-block:: python @@ -93,12 +93,12 @@ will default to a ``deploy`` dir inside of the ``builddir`` --------------------------------- Keys Usually Set by CLI --------------------------------- -The following keys are normally set by the command line interface. However, you +The following keys are normally set by the command line interface. However, you can set them in the run control file should you choose to. ``cmd`` ========= -The command to run. +The command to run. .. code-block:: python @@ -111,11 +111,11 @@ The MongoDB client to use. This is almost always set by regolith internally. ``db`` ========= -The database to use. This should coorespond to the name field of one of the ``databases`` entries. +The database to use. This should correspond to the name field of one of the ``databases`` entries. ``coll`` ========= -The collection name inside of a database to use. +The collection name inside of a database to use. ``documents`` ================ @@ -128,7 +128,7 @@ Boolean for whether to select only public databases. ``filename`` ============== -Sting that is a path to a file to operate on. +String that is a path to a file to operate on. ``debug`` ================ diff --git a/github_deploy_key.enc b/github_deploy_key.enc deleted file mode 100644 index 4fce5faa3..000000000 --- a/github_deploy_key.enc +++ /dev/null @@ -1 +0,0 @@ -gAAAAABZwpV3UXuby9enStq0Hhn1FHi6-Qd2Zk9Y9E9DrTUShDGQU5hRSmuRg2qVTD7eQi__xHq9joODZ9iDEnOpn5sjR8H8CBNC_EftTndU51vpA5kADJotFqIRsr-80ukvVM1U2dhW9awUka7-QB9XRuE8Nb_Z68-FJx1ifbM2sppSpsO6Ika2IXJhNQFh3OvC0FdpAXDBe8PtS47ulyr-Vf_rvY2I24pBGOOHsqEjz1b6CrCbVDReelzYcbT-NQrz4DLsPe89dLirMPuGLllwnlE6HfRe013FW_KqH3RdsIMdFiGFGISxWgGFt02atE8ZCGqSIjGDRhnC2pVkO6WU2fNyrrnjb4kUAocnYeYpDhPJQ6HDULVO5cBSpPjJx34fgHzrmVOQ8QiF3XWtTK1HmqOwFcGwe_oSxM5yd-IeZcmYFmp-rJYl2jrRhNEBjpduq_-d52XAfbJXRhEc02N3RB51kKA-ih8g7yJHJg_I1pro9Jw0SnQ6iBAZh8U2xKduRGfRvxeEyvh3q6K3PDyo7BiYyhafzL1aUqvdN4SD0PP8cQWSkRKkxmMXDJG4hvKQqu2iX76tUzSv6Br7p5HmjSNJOu6KCumOPfMiCuWn6CgH7UJB6wiNgxsOo7axeZij5qM-ljRXQtTAyZ8TG1A0xEqkRxy567MjsoHzi_LxKN2hxCOXwj7g_oPOwg6VMssDrOibqwYQ2DWidgpRnE8kC5jpOPYRDAug09LWlgCCzM2hF2vZiMsAFp5eISUH8F3IiLbRFHvZ1RHoGR2Iim6vnfz6Uonp_4RHwF_FdtJUxWQe4PMk1u_WXsdE_KPoRcDlR35PMfuf7xfhRkrwO0GFWXoG3GCxH9jyHT73JQHfWdJZtfVmM1PszoyqBtNJW5MmYAwB7_EzEjdW-O9OnQlm5DP7E5AOJ4QeGEELRVp7089BMyOmCeqQJNZTx3-isWLRAEo109W1Ac6XBnYS72Iqi07eP175QqnkTi1nAyufmzpJuIOw6EIR_YgOUFsYyf6lDMKVGQ5GNZlSHGTeQZ1GTNiq9yP6tEybenKVXnMHK2yjlzdMr9VGX8mKDqZC4S0PmCsJmXinOSMQUgqwyF3Q9v63g22-DOlohcCxRHPgJEzAAFSsTTkcR9lv5T9VvBex27roEUkPOGR-51Dmgkxsrs42kCl3x4ZmxtH4inEHi_kvCKMY6qqIVrEgdTLh_erg3o5y6HAu7tDG213mK7U8jKuF5_lv9XZDQgqL551SvcU940lla5lfJRepyqx3USA5FFmfaLNUy2Swgarn8r8bPSSd-NTw9rWa34R-l04Yj7_PmvuovuY1lyqjyxy6F_TKElNFW8Xv5tM5sTktozCivn53D7ghhccZawMTZVsY92dfJSDt1PGMLqJ6FzdFWdSRq_vFWDoD4CRzOj7Yhpr8e5FAOoDoqPZX9rIhE8OmidXbIZ4QS5IZRPT1Q8k3pFXsQH6UFJv_KysxKLMj16FaZaFV3MtgwOdmz6KwkmjpVc39PZ3mQJIxPvgZkIcgODd5jw4glNUNiPzqdVqrfm8wu9ThlhnNAKbd3fEKgkT1YCEH-c8x5c1rJS8IrSBUYiSiUSaZSjXxmStEHaJcCYcwJA3qdHREThDO4aObqtfXyNolgeEKIndmGeA7sahhMBUpv40Hb7JHBYzUtQCJfgcDxGluUrpMUtC5f2LVSL2n-V8-E_3OBfcgTaQ-uNWuHcbKnKSc3mh57uw5oZpfgjq7-FDQlNxgClywsDg15C5xRLbaGQs0KpXh6EbnSnfo9_Ag1FfZgh3DTpSx6ndhJ68TdmecGhOGqsHleSs8U2GwWJoLXYuKYobbRdRYxHy7KpC5kMuBgkJNO2GF9maNuWEcq-6SyEp6qsOJ3G_KR2Lv0ybRB-MnzJhEO5vQ2O5EBlSk0GgkTfs2KqeHCW55eJLLBx2jcVALHircXeHYm8IvHddK6HVPyYQepcCF8obLtBnhCmHKjd-6GX0gbBgisxWkqEVbBN8wSW8r96AyJhVmRtR8h2akuWJX7z9RQGPH9OeP8c0hO3u5o81k7YmCBjgdvZTr6ld6oOwIrl3U7ZszqiJEr4YbFq7-JYFzw0R2uWyRQrtcRG3TkF_YKMBKCO6u1DITTyPXqGIzZXzIxQC8k8gqVMCLaViDgdbN0aHNG5M2g5Wt3Gy15B6l1-eQkMJVAhCFc43K7P1Eb-teXIBKCrqgr_hBZ3wzeSrw2M6HR1B4Zeq22wSDHH3bryQY-7yhiAcbJ6-Ci6FsM6qO_hzz6DoUjLwbvA4EpmSAXWPCOBxdxkYU-Old_6Ko7Fg8Sux7MotQ-i_pAmeaGvLCd5sOHvdt5Ibl_DqG7Yqkp5GLHM4pwQrnp4DL3baFwMuD5k6veXOb7iWiSBVXRbT87yi3WhOM3lEUcMQlFsjSvIH7aKWL8IBFOXod3Z4RizGBjjrpSVMphb5SS1ZsD_wfX9K1muI0SB1KbGfShmejX1hNM0-2myc3V4fbxcfU5AD1t3y5gIesUtgfbCLehpYIxVmJgJQH_EkbGWpIeCIL3ggEFTQElYhKfYT2N9r-Kx9EQL5rEJx49Kxu_IToV6TKGVNzev3buQtNMYGwx0Pfbch2IJwo2t5xETwKkdebIQg6zIiHNf8iG7yYEgj4Z83FMZdYrvEqna9WxSE4-15CGqpY0Ae7IZ0drimb5hTnjYTcP7zetSXmlHyHiDajGFrLqTum2M4jFuwoVIGdGee56phjN02U21-PCOa6qvts9uT1CgQ_4YAZWpCWK88DqJAHuCz7K0xPU2Y3Ff5Z61OwXOIGH1NfmZ-axXWPtS_IZJc-BLtZSP0XTjk9bqFmLgQRmCyk-Rcjze6dSuCJAInLzEBCvbxRXPf6RxP9U8AHUD5o84kHbGQ7o4EZVXr_gEY2bCCtHSaFvFvhXlPmaoD1vLHJysJWPRpnqKP2-s_SMZsXP0Iwhtcdy112T6yhrDAU0yDzWlIh8WG2-GI0eP5DjqW-Yy827AjH6BXaK1v0BJHCKxAwYX9Kps6VdibH1YWTZOZijlAhmscICQI_uJgadjZHwybCZ9LyNQGDA1KLjJNBnaB_99TiPm82brbw0JjUEMzrvu2fP3KKhfZrq4_TgFeV_DkZ55kEofX3yO8U5MKMt-tRkwrqtXyGlCfEpogyvhRw7ybjNNh82IrlOlMR2qJv1nyTEzsjDYXTBELqtojDdg-vxi8gny3D7cyKkbnQhnO4PtGW-tr-QjmjEwhbTZ0OO3Yk1AR6_tyyifBvqiBYTACuOeHVB7YobN_kziouvxaKKt0jZED7-5Od_CN9EaFfp5XYCOFpvpTcuifFAn7VrvwvKbJZKaNIN3MChBIYvk12QIy9I00y1OEy5vLhWJHNXw4H09QJKCRQ4uIRlTQArqTGQb__OuGJVU6KowYtnxX55ZC3f5Y-CQUnZ43Uq5MgTDnHfRTD8Epu9abn3skkUSS7AeASPTP3hdUyzsYbtp8cq2SPQ_Kn-PFtMwjozTsxKrHyOywbjLLrvr4EvNU25RN0GABK3c_6JK7TJF48mGk6FU1_7RTG8X144xAFjHa9_LSFoIDTg7K3hrWNqWFn8En1CZDcGtf3rrI-71-YKncIXzZdxti_O56o3UceqUON_fj-2mPZ4-PAwgrY-Z_D6tli1Jqi6In9k9noIUzhv4aSl3CYAvAtJjJ1erq7nppzc0Vj0gnfR1TQxfqo7Je2DC1H7gLioYw8m06NxXrBm7xEKUp_1VbCGx17Vc6diddGJ0IYHCuxWsoYlqrn_lSYPy7d_D5f4zSC4bwiXw6hEKfodPXQcIJ6Z_qxYjiMtLxgkhmUArasc6-YC2bqMiZ5FAp4LJHcf2hxQhfUByZcqE56aNrjhkWfTKSwJWLJcYkHddv6TeiEvzUtdfk5NWg_LNh0ligppodTSTmyMlC56xcIkGxQRzMUXf3zTlSm90v2PDtuPSC4pMfuRXHYbu2cPXnElNECAI_HLwcPoeeCqRpna2x8JJPJdFObcTamciQ2yAFUalxegdJ9ageZVh6Tbdnpb-iqiOmlo7HVnFtk8Js1Nnhya2q0l64vUYtG_3Wg7RIQ1L3-2zTOelxHauR0j3ISSieiNmfdovIH4hGdF1Uc3i9y9Ix_xY1qd6y54WXnioA_fgv0G30J87BE0zj-S0G0ZrBGFXO0URS86IK_0kCYcc_gCzi5otp6ZpuJ6o9W7EphhAuCzNxbzt8R1qIdxJ38Fo_Ov9hHIATDmyw61ab9hHiDAm3xH0IxY00zuPWfPFmc5LFKsB3K7FJwj7oW1275_4uWtinmlR6Z4g6U0u1LaAEhMyyU3GTFfB-7RIYpMgCTAWt4PGjnh8zg-KeKkmZvBsMddIRZ-rWTPvXSs3p3f80F_Zgb_8g= diff --git a/pyproject.toml b/pyproject.toml index abce09f05..02944560c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "regolith" -dynamic=['version'] +dynamic=['version', 'dependencies'] authors = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, { name="Anthony Scopatz", email="scopatz@gmail.com" }, @@ -13,10 +13,10 @@ maintainers = [ { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, { name="Anthony Scopatz", email="scopatz@gmail.com" }, ] -description = "A research group content management system" +description = "Python package for research group content management system" keywords = ["content management system"] readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.11, <3.14" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -27,10 +27,11 @@ classifiers = [ 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Operating System :: Unix', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Scientific/Engineering :: Chemistry', ] [tool.setuptools] @@ -48,9 +49,9 @@ dirty_template = "{tag}" [tool.setuptools.packages.find] where = ["src"] # list of folders that contain the packages (["."] by default) -include = ["regolith*"] # package names should match these glob patterns (["*"] by default) +include = ["*"] # package names should match these glob patterns (["*"] by default) exclude = [] # exclude packages matching these glob patterns (empty by default) -namespaces = true # to disable scanning PEP 420 namespaces (true by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.package-data] regolith = ["templates/*", @@ -60,6 +61,14 @@ regolith = ["templates/*", "*.json" ] +[tool.setuptools.dynamic] +dependencies = {file = ["requirements/pip.txt"]} + +[tool.codespell] +exclude-file = ".codespell/ignore_lines.txt" +ignore-words = ".codespell/ignore_words.txt" +skip = "*.cif,*.dat,*.js,*.tex,*.txt,*.html,*.bib,*.map,*.json" + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/requirements/conda.txt b/requirements/conda.txt index 5fea57386..1253aafb9 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -16,4 +16,3 @@ habanero google-api-python-client google-auth-oauthlib wxpython -gooey diff --git a/rever.xsh b/rever.xsh deleted file mode 100644 index 7270f322a..000000000 --- a/rever.xsh +++ /dev/null @@ -1,18 +0,0 @@ -$PROJECT = 'regolith' -$ACTIVITIES = ['version_bump', - 'changelog', - 'tag', - 'push_tag', - 'ghrelease', - 'conda_forge'] - -$VERSION_BUMP_PATTERNS = [ - ('regolith/__init__.py', '__version__\s*=.*', "__version__ = '$VERSION'"), - ('setup.py', 'version\s*=.*,', "version='$VERSION',") - ] -$CHANGELOG_FILENAME = 'CHANGELOG.rst' -$CHANGELOG_IGNORE = ['TEMPLATE.rst'] -$PUSH_TAG_REMOTE = 'git@github.com:regro/regolith.git' - -$GITHUB_ORG = 'regro' -$GITHUB_REPO = 'regolith' diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index f7926f10d..000000000 --- a/run_tests.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -import sys - -import pytest - -if __name__ == "__main__": - # show output results from every test function - args = ["-v"] - # show the message output for skipped and expected failure tests - if len(sys.argv) > 1: - args.extend(sys.argv[1:]) - print("pytest arguments: {}".format(args)) - # # compute coverage stats for xpdAcq - # args.extend(['--cov', 'xpdAcq']) - # call pytest and exit with the return code from pytest so that - # travis will fail correctly if tests fail - exit_res = pytest.main(args) - sys.exit(exit_res) diff --git a/src/regolith/broker.py b/src/regolith/broker.py index d58f73530..1c7b26f81 100644 --- a/src/regolith/broker.py +++ b/src/regolith/broker.py @@ -23,7 +23,7 @@ class Broker: >>> # Load the db >>> db = Broker.from_rc() - >>> # Get a docment from the broker + >>> # Get a document from the broker >>> ergs =db['group']['ergs'] >>> # Store a file >>> db.add_file(ergs, 'myfile', '/path/to/file/hello.txt') diff --git a/src/regolith/builders/coabuilder.py b/src/regolith/builders/coabuilder.py index 766fba389..c544eabc8 100644 --- a/src/regolith/builders/coabuilder.py +++ b/src/regolith/builders/coabuilder.py @@ -2,7 +2,7 @@ For the specified person it returns the name and institution of all graduate student and post-doc advisors, -all graduate student advisees, all post-doc advisees in the past 60 monts +all graduate student advisees, all post-doc advisees in the past 60 months and all coauthors in the past 48 months. """ @@ -253,7 +253,7 @@ def query_people_and_institutions(rc, names): def get_inst_name(person, rc): - """Get the name of instituion of the person's latest employment.""" + """Get the name of institution of the person's latest employment.""" if "employment" in person: org = get_recent_org(person) person_inst_abbr = org diff --git a/src/regolith/client_manager.py b/src/regolith/client_manager.py index 22038d099..3b9c792ec 100644 --- a/src/regolith/client_manager.py +++ b/src/regolith/client_manager.py @@ -97,13 +97,13 @@ def keys(self): return keys def collection_names(self, dbname, include_system_collections=True): - """Returns the collaction names for a database.""" + """Returns the collection names for a database.""" for client in self.clients: if dbname in client.keys(): return client.collection_names(dbname) def all_documents(self, collname, copy=True): - """Returns an iteratable over all documents in a collection.""" + """Returns an iterable over all documents in a collection.""" if copy: return deepcopy(self.chained_db.get(collname, {})).values() return self.chained_db.get(collname, {}).values() diff --git a/src/regolith/dates.py b/src/regolith/dates.py index b75ee7bee..1d3aa0c46 100644 --- a/src/regolith/dates.py +++ b/src/regolith/dates.py @@ -350,8 +350,8 @@ def get_due_date(thing): def is_current(thing, now=None): """ given a thing with dates, returns true if the thing is current - looks for begin_ and end_ daty things (date, year, month, day), or just - the daty things themselves. e.g., begin_date, end_month, month, and so on. + looks for begin_ and end_ date things (date, year, month, day), or just + the date things themselves. e.g., begin_date, end_month, month, and so on. Parameters ---------- diff --git a/src/regolith/emailer.py b/src/regolith/emailer.py index 079b2a872..0197827b3 100644 --- a/src/regolith/emailer.py +++ b/src/regolith/emailer.py @@ -39,8 +39,8 @@ def attach_pdf(filename): def make_message(rc, to, subject="", body="", attachments=()): - """Creates an email following the approriate format. The body kwarg - may be a string of restructured text. Attachements is a list of filenames + """Creates an email following the appropriate format. The body kwarg + may be a string of restructured text. Attachments is a list of filenames to attach. """ msg = MIMEMultipart("alternative") diff --git a/src/regolith/exemplars.json b/src/regolith/exemplars.json index 1c0cd4c8e..9cef5dcd3 100644 --- a/src/regolith/exemplars.json +++ b/src/regolith/exemplars.json @@ -440,7 +440,7 @@ { "institution": "University of South Carolina", "name": "Aaron Meurer", - "position": "researcher", + "position": "copi", "admin_people": ["A. D. Ministrator"] } ], @@ -480,7 +480,7 @@ { "institution": "University of South Carolina", "name": "Aaron Meurer", - "position": "researcher" + "position": "co-pi" } ], "status": "accepted", @@ -1087,7 +1087,7 @@ "location": "Chicago, IL", "organization": "Google", "other": [], - "position": "janitor", + "position": "research associate", "not_in_cv": true } ], diff --git a/src/regolith/fsclient.py b/src/regolith/fsclient.py index 39d14cd45..37336ae82 100644 --- a/src/regolith/fsclient.py +++ b/src/regolith/fsclient.py @@ -229,11 +229,11 @@ def __getitem__(self, key): return self.dbs[key] def collection_names(self, dbname, include_system_collections=True): - """Returns the collaction names for a database.""" + """Returns the collection names for a database.""" return set(self.dbs[dbname].keys()) def all_documents(self, collname, copy=True): - """Returns an iteratable over all documents in a collection.""" + """Returns an iterable over all documents in a collection.""" if copy: return deepcopy(self.chained_db.get(collname, {})).values() return self.chained_db.get(collname, {}).values() diff --git a/src/regolith/helper.py b/src/regolith/helper.py index e3231d3ab..b23ba45cc 100644 --- a/src/regolith/helper.py +++ b/src/regolith/helper.py @@ -52,7 +52,7 @@ "u_todo": (u_todo.TodoUpdaterHelper, u_todo.subparser), } -# Lister helpers need to load collections across all the databses to show everything +# Lister helpers need to load collections across all the databases to show everything LISTER_HELPERS = { "l_abstract": (l_abstract.AbstractListerHelper, l_abstract.subparser), "l_contacts": (l_contacts.ContactsListerHelper, l_contacts.subparser), diff --git a/src/regolith/helpers/a_projectumhelper.py b/src/regolith/helpers/a_projectumhelper.py index 9ab4841a5..429aa28d5 100644 --- a/src/regolith/helpers/a_projectumhelper.py +++ b/src/regolith/helpers/a_projectumhelper.py @@ -233,7 +233,7 @@ def insert_checklists(self, pdoc, now): presubmission_checklist = [ ( "Create slide figures", - "Create Inkscape graphics (Inkscape is preferrable over ppt) for the slides " + "Create Inkscape graphics (Inkscape is preferable over ppt) for the slides " "and place in a ``figures`` directory in the slides directory. " "These may then be used either in beamer or ppt. " "Iterate with PI to convergence. (to get started with Inkscape download and install it, " @@ -581,7 +581,7 @@ def insert_checklists(self, pdoc, now): "Read the paper", "Finally, after you have done all these 'mechanical' checks, " "read through the paper and try and find any typos or other problems. " - "Resist the temptation to do any rewriting here...you are looking for mispellings " + "Resist the temptation to do any rewriting here...you are looking for misspellings " "and missing or extra words and so on.", ), ( @@ -693,7 +693,7 @@ def insert_checklists(self, pdoc, now): "Update arXiv if necessary", "If the paper was listed on a preprint server like arXiv, submit a note to arXiv that the paper " "has appeared and give the full reference. If the journal copyright allows " - "you can post the published version here, but normally that is not alllowed! " + "you can post the published version here, but normally that is not allowed! " "Still, it is important that people who find the paper on arXiv " "get directed to the correct reference.", ), @@ -831,7 +831,7 @@ def insert_checklists(self, pdoc, now): # 'closes. The goal of this is that it will be ' # 'printed as a progress report for a grant ' # 'so write it as if it will be read by an external ' - # 'person. It doesnt have to describe the whole prum ' + # 'person. It doesn't have to describe the whole prum ' # 'but clearly show the progress that has been made. ' # 'It can be multiple paragraphs or a short statement' # 'depending on the situation', diff --git a/src/regolith/helpers/attestationshelper.py b/src/regolith/helpers/attestationshelper.py index 0ca2ca0f5..5ad64bbc3 100644 --- a/src/regolith/helpers/attestationshelper.py +++ b/src/regolith/helpers/attestationshelper.py @@ -86,7 +86,7 @@ def db_updater(self): print(rc.begin_date) raise RuntimeError( "Begin date needed for effort reporting. Please rerun specifying " - "--begin-date YYYY-MM-DD (and preferrably --end-date YYYY-MM-DD) " + "--begin-date YYYY-MM-DD (and preferably --end-date YYYY-MM-DD) " "or remove --effort-reporting if you " "want an attestation report for a grant" ) diff --git a/src/regolith/helpers/makeappointmentshelper.py b/src/regolith/helpers/makeappointmentshelper.py index 7f3c31037..98fcad15c 100644 --- a/src/regolith/helpers/makeappointmentshelper.py +++ b/src/regolith/helpers/makeappointmentshelper.py @@ -112,13 +112,13 @@ def plotter(datearray, student=None, pd=None, ss=None, title=None): pda = numpy.array(pd) / 30.5 ssa = numpy.array(ss) / 30.5 if student: - ax.plot_date(datearray, sta, fmt=",-", label="student months") + ax.plot(datearray, sta, ",-", label="student months") if pd: - ax.plot_date(datearray, pda, fmt=",-", label="postdoc months") + ax.plot(datearray, pda, ",-", label="postdoc months") if ss: - ax.plot_date(datearray, ssa, fmt=",-", label="ss months") + ax.plot(datearray, ssa, ",-", label="ss months") if student and pd: - ax.plot_date(datearray, sta + pda, fmt=",-", label="student+postdoc days") + ax.plot(datearray, sta + pda, ",-", label="student+postdoc days") ax.set_xlabel("date") ax.set_ylabel("budget months remaining") ax.set_title(title) diff --git a/src/regolith/main.py b/src/regolith/main.py index 02c1dc110..ac2eeee35 100644 --- a/src/regolith/main.py +++ b/src/regolith/main.py @@ -55,7 +55,7 @@ def create_parser(): "--coll", dest="coll", default=None, - help="collection name, if this is not given it is infered from the " "file type or file name.", + help="collection name, if this is not given it is inferred from the " "file type or file name.", ) # store subparser diff --git a/src/regolith/runcontrol.py b/src/regolith/runcontrol.py index f3b01223a..51a3fa5f7 100644 --- a/src/regolith/runcontrol.py +++ b/src/regolith/runcontrol.py @@ -248,7 +248,7 @@ def load_rcfile(fname): if ext == ".json": rc = load_json_rcfile(fname) else: - raise RuntimeError("could not detemine run control file type from extension.") + raise RuntimeError("could not determine run control file type from extension.") return rc diff --git a/src/regolith/schemas.py b/src/regolith/schemas.py index 28e0e98d1..b4a93ffe1 100644 --- a/src/regolith/schemas.py +++ b/src/regolith/schemas.py @@ -37,7 +37,7 @@ "research_wish", ], "GRANT_STATI": ["pending", "declined", "accepted", "in-prep"], - "GRANT_ROLES": ["pi", "copi"], + "GRANT_ROLES": ["pi", "copi", "co-pi"], "MILESTONE_TYPES": [ "mergedpr", "meeting", @@ -161,7 +161,7 @@ def load_exemplars(): for s in SCHEMAS: SCHEMAS[s]["files"] = { "description": "Files associated with the document", - # TODO: fix this since this is currently comming out a CommentedMap (+1: Yevgeny) + # TODO: fix this since this is currently coming out a CommentedMap (+1: Yevgeny) # "type": "list", # "schema": {"type": "string"}, "required": False, diff --git a/src/regolith/tests/conftest.py b/src/regolith/tests/conftest.py deleted file mode 100644 index 7d85d6521..000000000 --- a/src/regolith/tests/conftest.py +++ /dev/null @@ -1,511 +0,0 @@ -"""Copyright (c) 2017, Anthony Scopatz -All rights reserved.""" - -import json -import os -import tempfile -from copy import deepcopy -from subprocess import CalledProcessError - -import pytest -from pymongo import MongoClient -from pymongo import errors as mongo_errors -from xonsh.api import subprocess -from xonsh.api.os import rmtree - -from regolith.fsclient import dump_yaml -from regolith.schemas import EXEMPLARS - -OUTPUT_FAKE_DB = False # always turn it to false after you used it -# Currently the first two must be named test solely to match the helper map test output text -REGOLITH_MONGODB_NAME = "test" -FS_DB_NAME = "test" -ALTERNATE_REGOLITH_MONGODB_NAME = "mongo_test" - - -@pytest.fixture(scope="session") -def make_db(): - """A test fixutre that creates and destroys a git repo in a temporary - directory. - This will yield the path to the repo. - """ - cwd = os.getcwd() - name = "regolith_fake" - repo = os.path.join(tempfile.gettempdir(), name) - if os.path.exists(repo): - rmtree(repo) - subprocess.run(["git", "init", repo]) - os.chdir(repo) - with open("README", "w") as f: - f.write("testing " + name) - with open("regolithrc.json", "w") as f: - json.dump( - { - "default_user_id": "sbillinge", - "groupname": "ERGS", - "databases": [ - { - "name": "test", - "url": repo, - "public": True, - "path": "db", - "local": True, - "backend": "filesystem", - } - ], - "repos": [ - { - "_id": "talk_repo", - "params": {"namespace_id": "35", "initialize_with_readme": "true", "name": "repo name"}, - "url": "https://example.com", - "api_route": "/url/example", - "namespace_name": "talks", - } - ], - "stores": [ - { - "name": "store", - "url": repo, - "path": repo, - "public": True, - } - ], - "tokens": [{"_id": "gitlab_private_token", "token": ""}], - }, - f, - ) - fspath = os.path.join(repo, "db") - os.mkdir(fspath) - exemplars_to_fs(fspath) - subprocess.run(["git", "add", "."]) - subprocess.run(["git", "commit", "-am", "Initial readme"]) - yield repo - os.chdir(cwd) - if not OUTPUT_FAKE_DB: - rmtree(repo) - - -@pytest.fixture(scope="module") -def make_mongodb(): - """A test fixture that creates and destroys a git repo in a temporary - directory, as well as a mongo database. - This will yield the path to the repo. - """ - forked = False - name = "regolith_mongo_fake" - repo = os.path.join(tempfile.gettempdir(), name) - if os.path.exists(repo): - rmtree(repo) - subprocess.run(["git", "init", repo]) - os.chdir(repo) - with open("README", "w") as f: - f.write("testing " + name) - mongodbpath = os.path.join(repo, "dbs") - os.mkdir(mongodbpath) - with open("regolithrc.json", "w") as f: - json.dump( - { - "groupname": "ERGS", - "databases": [ - { - "name": REGOLITH_MONGODB_NAME, - "url": "localhost", - "path": repo, - "public": True, - "local": True, - "backend": "mongodb", - } - ], - "stores": [ - { - "name": "store", - "url": repo, - "path": repo, - "public": True, - } - ], - "mongodbpath": mongodbpath, - }, - f, - ) - if os.name == "nt": - # If on windows, the mongod command cannot be run with the fork or syslog options. - # Instead, it is installed as a service and the exceptions that would typically be log outputs - # are handled by the exception handlers below. In addition, the database must always be manually - # deleted from the windows mongo instance before running a fresh test. - cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "Mongodb likely has not been installed as a service. In order to run mongodb tests, make sure\n" - "to install the mongodb community edition with the following link: \n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - cmd = ["mongostat", "--host", "localhost", "-n", "1"] - else: - cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] - forked = True - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "If using linux or mac, Mongod command failed to execute. " - "If using windows, the status of mongo could \n not be retrieved. " - "In order to run mongodb tests, make sure to install the mongodb community edition with " - "\nthe following link:\n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - try: - exemplars_to_mongo(REGOLITH_MONGODB_NAME) - except ConnectionError: - yield False - return - yield repo - cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - f'Deleting the test database failed, insert "mongo {REGOLITH_MONGODB_NAME} --eval ' - f'"db.dropDatabase()"" into command line manually' - ) - shut_down_fork(forked, repo) - if not OUTPUT_FAKE_DB: - rmtree(repo) - - -@pytest.fixture(scope="module") -def make_mixed_db(): - """A test fixture that creates and destroys a git repo in a temporary - directory, as well as a mongo database. - This will yield the path to the repo. - - This specific test fixture points to a repo that mixes mongo and filesystem backends for the assignments and - abstracts test collections in EXEMPLARS respectively. - """ - cwd = os.getcwd() - forked = False - name = "regolith_mongo_fake" - repo = os.path.join(tempfile.gettempdir(), name) - if os.path.exists(repo): - rmtree(repo) - subprocess.run(["git", "init", repo]) - os.chdir(repo) - with open("README", "w") as f: - f.write("testing " + name) - mongodbpath = os.path.join(repo, "dbs") - os.mkdir(mongodbpath) - fspath = os.path.join(repo, "db") - os.mkdir(fspath) - with open("regolithrc.json", "w") as f: - json.dump( - { - "groupname": "ERGS", - "databases": [ - { - "name": REGOLITH_MONGODB_NAME, - "url": "localhost", - "path": repo, - "public": True, - "local": True, - "backend": "mongodb", - }, - { - "name": FS_DB_NAME, - "url": repo, - "public": True, - "path": "db", - "local": True, - "backend": "filesystem", - }, - ], - "stores": [ - { - "name": "store", - "url": repo, - "path": repo, - "public": True, - } - ], - "mongodbpath": mongodbpath, - }, - f, - ) - if os.name == "nt": - # If on windows, the mongod command cannot be run with the fork or syslog options. - # Instead, it is installed as a service and the exceptions that would typically be log outputs - # are handled by the exception handlers below. In addition, the database must always be manually - # deleted from the windows mongo instance before running a fresh test. - cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "Mongod likely has not been installed as a service. In order to run mongodb tests, make sure\n" - "to install the mongodb community edition with the following link: \n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - cmd = ["mongostat", "--host", "localhost", "-n", "1"] - else: - cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] - forked = True - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "If on linux/mac, Mongod command failed to execute. If on windows, the status of mongo could not be\n" - "retrieved. In order to run mongodb tests, make sure to install the mongodb community edition with\n" - "the following link:\n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - # Write one collection doc in mongo - mongo_coll = "assignments" - try: - exemplars_to_mongo(REGOLITH_MONGODB_NAME, collection_list=[mongo_coll]) - except ConnectionError: - yield False - return - # Write one collection doc in file system - fs_coll = "abstracts" - exemplars_to_fs(fspath, collection_list=[fs_coll]) - yield repo, fs_coll, mongo_coll - cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - f'Deleting the test database failed, insert "mongo {REGOLITH_MONGODB_NAME} --eval ' - f'"db.dropDatabase()"" into command line manually' - ) - shut_down_fork(forked, repo) - os.chdir(cwd) - if not OUTPUT_FAKE_DB: - rmtree(repo) - - -@pytest.fixture(scope="session") -def make_bad_db(): - """A test fixutre that creates and destroys a git repo in a temporary - directory. - This will yield the path to the repo. - """ - cwd = os.getcwd() - name = "regolith_fake_bad" - repo = os.path.join(tempfile.gettempdir(), name) - if os.path.exists(repo): - rmtree(repo) - subprocess.run(["git", "init", repo]) - os.chdir(repo) - with open("README", "w") as f: - f.write("testing " + name) - with open("regolithrc.json", "w") as f: - json.dump( - { - "groupname": "ERGS", - "databases": [ - { - "name": "test", - "url": repo, - "public": True, - "path": "db", - "local": True, - } - ], - }, - f, - ) - os.mkdir("db") - # Write collection docs - for coll, example in deepcopy(EXEMPLARS).items(): - if isinstance(example, list): - d = {dd["_id"]: dd for dd in example} - else: - d = {example["_id"]: example} - d.update({"bad": {"_id": "bad", "bad": True}}) - if coll == "presentations": - d.update( - { - "bad_inst": { - "_id": "bad_inst", - "institution": "noinstitution", - "department": "nodept", - } - } - ) - dump_yaml("db/{}.yaml".format(coll), d) - subprocess.run(["git", "add", "."]) - subprocess.run(["git", "commit", "-am", "Initial readme"]) - yield repo - os.chdir(cwd) - rmtree(repo) - - -@pytest.fixture(scope="function") -def make_fs_to_mongo_migration_db(): - """A test fixture that creates and destroys a git repo in a temporary - directory, as well as a mongo database. - This will yield the path to the repo. - - This specific test fixture points to a repo that contains mongo and filesystem backends with only the - filesystem containing the exemplars. This is meant for use in migration testing. - """ - yield from make_migration_db(True) - - -@pytest.fixture(scope="function") -def make_mongo_to_fs_backup_db(): - """A test fixture that creates and destroys a git repo in a temporary - directory, as well as a mongo database. - This will yield the path to the repo. - - This specific test fixture points to a repo that contains mongo and filesystem backends with only the - filesystem containing the exemplars. This is meant for use in migration testing. - """ - yield from make_migration_db(False) - - -def make_migration_db(fs_to_mongo_true__mongo_to_fs_false): - cwd = os.getcwd() - forked = False - name = "regolith_mongo_fake" - repo = os.path.join(tempfile.gettempdir(), name) - if os.path.exists(repo): - rmtree(repo) - subprocess.run(["git", "init", repo]) - os.chdir(repo) - with open("README", "w") as f: - f.write("testing " + name) - mongodbpath = os.path.join(repo, "dbs") - os.mkdir(mongodbpath) - fspath = os.path.join(repo, "db") - os.mkdir(fspath) - with open("regolithrc.json", "w") as f: - json.dump( - { - "groupname": "ERGS", - "databases": [ - { - "name": ALTERNATE_REGOLITH_MONGODB_NAME, - "dst_url": "localhost", - "url": repo, - "path": "db", - "public": True, - "local": True, - "backend": "mongodb", - } - ], - "mongodbpath": mongodbpath, - }, - f, - ) - if os.name == "nt": - # If on windows, the mongod command cannot be run with the fork or syslog options. - # Instead, it is installed as a service and the exceptions that would typically be log outputs - # are handled by the exception handlers below. In addition, the database must always be manually - # deleted from the windows mongo instance before running a fresh test. - cmd = ["mongo", ALTERNATE_REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "Mongod likely has not been installed as a service. In order to run mongodb tests, make sure\n" - "to install the mongodb community edition with the following link: \n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - cmd = ["mongostat", "--host", "localhost", "-n", "1"] - else: - cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] - forked = True - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - "If on linux/mac, Mongod command failed to execute. If on windows, the status of mongo could not be\n" - "retrieved. In order to run mongodb tests, make sure to install the mongodb community edition with\n" - "the following link:\n" - "https://docs.mongodb.com/manual/installation/" - ) - yield False - return - if fs_to_mongo_true__mongo_to_fs_false: - exemplars_to_fs(fspath) - else: - exemplars_to_mongo(ALTERNATE_REGOLITH_MONGODB_NAME) - yield repo - cmd = ["mongo", ALTERNATE_REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - f'Deleting the test database failed, insert "mongo {ALTERNATE_REGOLITH_MONGODB_NAME} --eval ' - f'"db.dropDatabase()"" into command line manually' - ) - shut_down_fork(forked, repo) - os.chdir(cwd) - if not OUTPUT_FAKE_DB: - rmtree(repo) - - -def shut_down_fork(forked, repo): - if forked: - cmd = ["mongo", "admin", "--eval", "db.shutdownServer()"] - try: - subprocess.check_call(cmd, cwd=repo) - except CalledProcessError: - print( - 'Deleting the test database failed, insert "mongo admin --eval ' - '"db.shutdownServer()"" into command line manually' - ) - - -def exemplars_to_fs(fspath, collection_list=None): - exemplars_copy = deepcopy(EXEMPLARS) - if collection_list is None: - exemplars = exemplars_copy - else: - exemplars = {k: exemplars_copy[k] for k in collection_list if k in exemplars_copy} - cwd = os.getcwd() - os.chdir(fspath) - for coll, example in exemplars.items(): - if isinstance(example, list): - d = {dd["_id"]: dd for dd in example} - else: - d = {example["_id"]: example} - dump_yaml("{}.yaml".format(coll), d) - os.chdir(cwd) - - -def exemplars_to_mongo(mongo_db_name, collection_list=None): - exemplars_copy = deepcopy(EXEMPLARS) - if collection_list is None: - exemplars = exemplars_copy - else: - exemplars = {k: exemplars_copy[k] for k in collection_list if k in exemplars_copy} - client = MongoClient("localhost", serverSelectionTimeoutMS=2000) - client.server_info() - for col_name, example in exemplars.items(): - db = client[mongo_db_name] - col = db[col_name] - try: - if isinstance(example, list): - for doc in example: - doc["_id"].replace(".", "") - col.insert_many(example) - else: - example["_id"].replace(".", "") - col.insert_one(example) - except mongo_errors.DuplicateKeyError: - print("Duplicate key error, check exemplars for duplicates if tests fail") - except mongo_errors.BulkWriteError: - print("Duplicate key error, check exemplars for duplicates if tests fail") diff --git a/src/regolith/tools.py b/src/regolith/tools.py index a7e7e476e..9ab5a5c57 100644 --- a/src/regolith/tools.py +++ b/src/regolith/tools.py @@ -970,7 +970,7 @@ def fuzzy_retrieval(documents, sources, value, case_sensitive=True): def number_suffix(number): """returns the suffix that adjectivises a number (st, nd, rd, th) - Paramters + Parameters --------- number: integer The number. If number is not an integer, returns an empty string @@ -1195,7 +1195,7 @@ def get_person_contact(name, people_coll, contacts_coll): def merge_collections_intersect(a, b, target_id): """ - merge two collections such thta just the intersection is returned + merge two collections such that just the intersection is returned for shared keys that are in both collections, the value in b will be kept @@ -2211,7 +2211,7 @@ def get_target_token(target_token_id, tokens): def create_repo(destination_id, token_info_id, rc): - """Creates a repo at the target distination + """Creates a repo at the target destination tries to fail gracefully if repo information and token is not defined diff --git a/src/regolith/tests/__init__.py b/tests/__init__.py similarity index 100% rename from src/regolith/tests/__init__.py rename to tests/__init__.py diff --git a/src/regolith/tests/bootstrap_builders.py b/tests/bootstrap_builders.py similarity index 100% rename from src/regolith/tests/bootstrap_builders.py rename to tests/bootstrap_builders.py diff --git a/tests/conftest.py b/tests/conftest.py index e3b63139b..6762fd7ec 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,30 @@ +"""Copyright (c) 2017, Anthony Scopatz +All rights reserved.""" + import json +import os +import tempfile +from copy import deepcopy from pathlib import Path +from subprocess import CalledProcessError import pytest +from pymongo import MongoClient +from pymongo import errors as mongo_errors +from xonsh.api import subprocess +from xonsh.api.os import rmtree + +from regolith.fsclient import dump_yaml +from regolith.schemas import EXEMPLARS +OUTPUT_FAKE_DB = False # always turn it to false after you used it +# Currently the first two must be named test solely to match the helper map test output text +REGOLITH_MONGODB_NAME = "test" +FS_DB_NAME = "test" +ALTERNATE_REGOLITH_MONGODB_NAME = "mongo_test" + +# copied over from cookiecutter conftest.py @pytest.fixture def user_filesystem(tmp_path): base_dir = Path(tmp_path) @@ -17,3 +38,491 @@ def user_filesystem(tmp_path): json.dump(home_config_data, f) yield tmp_path + + +@pytest.fixture(scope="session") +def make_db(): + """A test fixutre that creates and destroys a git repo in a temporary + directory. + This will yield the path to the repo. + """ + cwd = os.getcwd() + name = "regolith_fake" + repo = os.path.join(tempfile.gettempdir(), name) + if os.path.exists(repo): + rmtree(repo) + subprocess.run(["git", "init", repo]) + os.chdir(repo) + with open("README", "w") as f: + f.write("testing " + name) + with open("regolithrc.json", "w") as f: + json.dump( + { + "default_user_id": "sbillinge", + "groupname": "ERGS", + "databases": [ + { + "name": "test", + "url": repo, + "public": True, + "path": "db", + "local": True, + "backend": "filesystem", + } + ], + "repos": [ + { + "_id": "talk_repo", + "params": {"namespace_id": "35", "initialize_with_readme": "true", "name": "repo name"}, + "url": "https://example.com", + "api_route": "/url/example", + "namespace_name": "talks", + } + ], + "stores": [ + { + "name": "store", + "url": repo, + "path": repo, + "public": True, + } + ], + "tokens": [{"_id": "gitlab_private_token", "token": ""}], + }, + f, + ) + fspath = os.path.join(repo, "db") + os.mkdir(fspath) + exemplars_to_fs(fspath) + subprocess.run(["git", "add", "."]) + subprocess.run(["git", "commit", "-am", "Initial readme"]) + yield repo + os.chdir(cwd) + if not OUTPUT_FAKE_DB: + rmtree(repo) + + +@pytest.fixture(scope="module") +def make_mongodb(): + """A test fixture that creates and destroys a git repo in a temporary + directory, as well as a mongo database. + This will yield the path to the repo. + """ + forked = False + name = "regolith_mongo_fake" + repo = os.path.join(tempfile.gettempdir(), name) + if os.path.exists(repo): + rmtree(repo) + subprocess.run(["git", "init", repo]) + os.chdir(repo) + with open("README", "w") as f: + f.write("testing " + name) + mongodbpath = os.path.join(repo, "dbs") + os.mkdir(mongodbpath) + with open("regolithrc.json", "w") as f: + json.dump( + { + "groupname": "ERGS", + "databases": [ + { + "name": REGOLITH_MONGODB_NAME, + "url": "localhost", + "path": repo, + "public": True, + "local": True, + "backend": "mongodb", + } + ], + "stores": [ + { + "name": "store", + "url": repo, + "path": repo, + "public": True, + } + ], + "mongodbpath": mongodbpath, + }, + f, + ) + if os.name == "nt": + # If on windows, the mongod command cannot be run with the fork or syslog options. + # Instead, it is installed as a service and the exceptions that would typically be log outputs + # are handled by the exception handlers below. In addition, the database must always be manually + # deleted from the windows mongo instance before running a fresh test. + cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "Mongodb likely has not been installed as a service. In order to run mongodb tests, make sure\n" + "to install the mongodb community edition with the following link: \n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + cmd = ["mongostat", "--host", "localhost", "-n", "1"] + else: + cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] + forked = True + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "If using linux or mac, Mongod command failed to execute. " + "If using windows, the status of mongo could \n not be retrieved. " + "In order to run mongodb tests, make sure to install the mongodb community edition with " + "\nthe following link:\n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + try: + exemplars_to_mongo(REGOLITH_MONGODB_NAME) + except ConnectionError: + yield False + return + yield repo + cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + f'Deleting the test database failed, insert "mongo {REGOLITH_MONGODB_NAME} --eval ' + f'"db.dropDatabase()"" into command line manually' + ) + shut_down_fork(forked, repo) + if not OUTPUT_FAKE_DB: + rmtree(repo) + + +@pytest.fixture(scope="module") +def make_mixed_db(): + """A test fixture that creates and destroys a git repo in a temporary + directory, as well as a mongo database. + This will yield the path to the repo. + + This specific test fixture points to a repo that mixes mongo and filesystem backends for the assignments and + abstracts test collections in EXEMPLARS respectively. + """ + cwd = os.getcwd() + forked = False + name = "regolith_mongo_fake" + repo = os.path.join(tempfile.gettempdir(), name) + if os.path.exists(repo): + rmtree(repo) + subprocess.run(["git", "init", repo]) + os.chdir(repo) + with open("README", "w") as f: + f.write("testing " + name) + mongodbpath = os.path.join(repo, "dbs") + os.mkdir(mongodbpath) + fspath = os.path.join(repo, "db") + os.mkdir(fspath) + with open("regolithrc.json", "w") as f: + json.dump( + { + "groupname": "ERGS", + "databases": [ + { + "name": REGOLITH_MONGODB_NAME, + "url": "localhost", + "path": repo, + "public": True, + "local": True, + "backend": "mongodb", + }, + { + "name": FS_DB_NAME, + "url": repo, + "public": True, + "path": "db", + "local": True, + "backend": "filesystem", + }, + ], + "stores": [ + { + "name": "store", + "url": repo, + "path": repo, + "public": True, + } + ], + "mongodbpath": mongodbpath, + }, + f, + ) + if os.name == "nt": + # If on windows, the mongod command cannot be run with the fork or syslog options. + # Instead, it is installed as a service and the exceptions that would typically be log outputs + # are handled by the exception handlers below. In addition, the database must always be manually + # deleted from the windows mongo instance before running a fresh test. + cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "Mongod likely has not been installed as a service. In order to run mongodb tests, make sure\n" + "to install the mongodb community edition with the following link: \n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + cmd = ["mongostat", "--host", "localhost", "-n", "1"] + else: + cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] + forked = True + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "If on linux/mac, Mongod command failed to execute. If on windows, the status of mongo could not be\n" + "retrieved. In order to run mongodb tests, make sure to install the mongodb community edition with\n" + "the following link:\n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + # Write one collection doc in mongo + mongo_coll = "assignments" + try: + exemplars_to_mongo(REGOLITH_MONGODB_NAME, collection_list=[mongo_coll]) + except ConnectionError: + yield False + return + # Write one collection doc in file system + fs_coll = "abstracts" + exemplars_to_fs(fspath, collection_list=[fs_coll]) + yield repo, fs_coll, mongo_coll + cmd = ["mongo", REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + f'Deleting the test database failed, insert "mongo {REGOLITH_MONGODB_NAME} --eval ' + f'"db.dropDatabase()"" into command line manually' + ) + shut_down_fork(forked, repo) + os.chdir(cwd) + if not OUTPUT_FAKE_DB: + rmtree(repo) + + +@pytest.fixture(scope="session") +def make_bad_db(): + """A test fixutre that creates and destroys a git repo in a temporary + directory. + This will yield the path to the repo. + """ + cwd = os.getcwd() + name = "regolith_fake_bad" + repo = os.path.join(tempfile.gettempdir(), name) + if os.path.exists(repo): + rmtree(repo) + subprocess.run(["git", "init", repo]) + os.chdir(repo) + with open("README", "w") as f: + f.write("testing " + name) + with open("regolithrc.json", "w") as f: + json.dump( + { + "groupname": "ERGS", + "databases": [ + { + "name": "test", + "url": repo, + "public": True, + "path": "db", + "local": True, + } + ], + }, + f, + ) + os.mkdir("db") + # Write collection docs + for coll, example in deepcopy(EXEMPLARS).items(): + if isinstance(example, list): + d = {dd["_id"]: dd for dd in example} + else: + d = {example["_id"]: example} + d.update({"bad": {"_id": "bad", "bad": True}}) + if coll == "presentations": + d.update( + { + "bad_inst": { + "_id": "bad_inst", + "institution": "noinstitution", + "department": "nodept", + } + } + ) + dump_yaml("db/{}.yaml".format(coll), d) + subprocess.run(["git", "add", "."]) + subprocess.run(["git", "commit", "-am", "Initial readme"]) + yield repo + os.chdir(cwd) + rmtree(repo) + + +@pytest.fixture(scope="function") +def make_fs_to_mongo_migration_db(): + """A test fixture that creates and destroys a git repo in a temporary + directory, as well as a mongo database. + This will yield the path to the repo. + + This specific test fixture points to a repo that contains mongo and filesystem backends with only the + filesystem containing the exemplars. This is meant for use in migration testing. + """ + yield from make_migration_db(True) + + +@pytest.fixture(scope="function") +def make_mongo_to_fs_backup_db(): + """A test fixture that creates and destroys a git repo in a temporary + directory, as well as a mongo database. + This will yield the path to the repo. + + This specific test fixture points to a repo that contains mongo and filesystem backends with only the + filesystem containing the exemplars. This is meant for use in migration testing. + """ + yield from make_migration_db(False) + + +def make_migration_db(fs_to_mongo_true__mongo_to_fs_false): + cwd = os.getcwd() + forked = False + name = "regolith_mongo_fake" + repo = os.path.join(tempfile.gettempdir(), name) + if os.path.exists(repo): + rmtree(repo) + subprocess.run(["git", "init", repo]) + os.chdir(repo) + with open("README", "w") as f: + f.write("testing " + name) + mongodbpath = os.path.join(repo, "dbs") + os.mkdir(mongodbpath) + fspath = os.path.join(repo, "db") + os.mkdir(fspath) + with open("regolithrc.json", "w") as f: + json.dump( + { + "groupname": "ERGS", + "databases": [ + { + "name": ALTERNATE_REGOLITH_MONGODB_NAME, + "dst_url": "localhost", + "url": repo, + "path": "db", + "public": True, + "local": True, + "backend": "mongodb", + } + ], + "mongodbpath": mongodbpath, + }, + f, + ) + if os.name == "nt": + # If on windows, the mongod command cannot be run with the fork or syslog options. + # Instead, it is installed as a service and the exceptions that would typically be log outputs + # are handled by the exception handlers below. In addition, the database must always be manually + # deleted from the windows mongo instance before running a fresh test. + cmd = ["mongo", ALTERNATE_REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "Mongod likely has not been installed as a service. In order to run mongodb tests, make sure\n" + "to install the mongodb community edition with the following link: \n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + cmd = ["mongostat", "--host", "localhost", "-n", "1"] + else: + cmd = ["mongod", "--fork", "--syslog", "--dbpath", mongodbpath] + forked = True + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + "If on linux/mac, Mongod command failed to execute. If on windows, the status of mongo could not be\n" + "retrieved. In order to run mongodb tests, make sure to install the mongodb community edition with\n" + "the following link:\n" + "https://docs.mongodb.com/manual/installation/" + ) + yield False + return + if fs_to_mongo_true__mongo_to_fs_false: + exemplars_to_fs(fspath) + else: + exemplars_to_mongo(ALTERNATE_REGOLITH_MONGODB_NAME) + yield repo + cmd = ["mongo", ALTERNATE_REGOLITH_MONGODB_NAME, "--eval", "db.dropDatabase()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + f'Deleting the test database failed, insert "mongo {ALTERNATE_REGOLITH_MONGODB_NAME} --eval ' + f'"db.dropDatabase()"" into command line manually' + ) + shut_down_fork(forked, repo) + os.chdir(cwd) + if not OUTPUT_FAKE_DB: + rmtree(repo) + + +def shut_down_fork(forked, repo): + if forked: + cmd = ["mongo", "admin", "--eval", "db.shutdownServer()"] + try: + subprocess.check_call(cmd, cwd=repo) + except CalledProcessError: + print( + 'Deleting the test database failed, insert "mongo admin --eval ' + '"db.shutdownServer()"" into command line manually' + ) + + +def exemplars_to_fs(fspath, collection_list=None): + exemplars_copy = deepcopy(EXEMPLARS) + if collection_list is None: + exemplars = exemplars_copy + else: + exemplars = {k: exemplars_copy[k] for k in collection_list if k in exemplars_copy} + cwd = os.getcwd() + os.chdir(fspath) + for coll, example in exemplars.items(): + if isinstance(example, list): + d = {dd["_id"]: dd for dd in example} + else: + d = {example["_id"]: example} + dump_yaml("{}.yaml".format(coll), d) + os.chdir(cwd) + + +def exemplars_to_mongo(mongo_db_name, collection_list=None): + exemplars_copy = deepcopy(EXEMPLARS) + if collection_list is None: + exemplars = exemplars_copy + else: + exemplars = {k: exemplars_copy[k] for k in collection_list if k in exemplars_copy} + client = MongoClient("localhost", serverSelectionTimeoutMS=2000) + client.server_info() + for col_name, example in exemplars.items(): + db = client[mongo_db_name] + col = db[col_name] + try: + if isinstance(example, list): + for doc in example: + doc["_id"].replace(".", "") + col.insert_many(example) + else: + example["_id"].replace(".", "") + col.insert_one(example) + except mongo_errors.DuplicateKeyError: + print("Duplicate key error, check exemplars for duplicates if tests fail") + except mongo_errors.BulkWriteError: + print("Duplicate key error, check exemplars for duplicates if tests fail") diff --git a/src/regolith/tests/outputs/a_expense/expenses.yaml b/tests/outputs/a_expense/expenses.yaml similarity index 100% rename from src/regolith/tests/outputs/a_expense/expenses.yaml rename to tests/outputs/a_expense/expenses.yaml diff --git a/src/regolith/tests/outputs/a_grppub_readlist/reading_lists.yaml b/tests/outputs/a_grppub_readlist/reading_lists.yaml similarity index 100% rename from src/regolith/tests/outputs/a_grppub_readlist/reading_lists.yaml rename to tests/outputs/a_grppub_readlist/reading_lists.yaml diff --git a/src/regolith/tests/outputs/a_manurev/refereeReports.yaml b/tests/outputs/a_manurev/refereeReports.yaml similarity index 100% rename from src/regolith/tests/outputs/a_manurev/refereeReports.yaml rename to tests/outputs/a_manurev/refereeReports.yaml diff --git a/src/regolith/tests/outputs/a_presentation/expenses.yaml b/tests/outputs/a_presentation/expenses.yaml similarity index 100% rename from src/regolith/tests/outputs/a_presentation/expenses.yaml rename to tests/outputs/a_presentation/expenses.yaml diff --git a/src/regolith/tests/outputs/a_presentation/presentations.yaml b/tests/outputs/a_presentation/presentations.yaml similarity index 100% rename from src/regolith/tests/outputs/a_presentation/presentations.yaml rename to tests/outputs/a_presentation/presentations.yaml diff --git a/src/regolith/tests/outputs/a_projectum/projecta.yaml b/tests/outputs/a_projectum/projecta.yaml similarity index 100% rename from src/regolith/tests/outputs/a_projectum/projecta.yaml rename to tests/outputs/a_projectum/projecta.yaml diff --git a/src/regolith/tests/outputs/a_proposal/proposals.yaml b/tests/outputs/a_proposal/proposals.yaml similarity index 100% rename from src/regolith/tests/outputs/a_proposal/proposals.yaml rename to tests/outputs/a_proposal/proposals.yaml diff --git a/src/regolith/tests/outputs/a_todo/todos.yaml b/tests/outputs/a_todo/todos.yaml similarity index 100% rename from src/regolith/tests/outputs/a_todo/todos.yaml rename to tests/outputs/a_todo/todos.yaml diff --git a/src/regolith/tests/outputs/annual-activity/sbillinge-ann-report.tex b/tests/outputs/annual-activity/sbillinge-ann-report.tex similarity index 100% rename from src/regolith/tests/outputs/annual-activity/sbillinge-ann-report.tex rename to tests/outputs/annual-activity/sbillinge-ann-report.tex diff --git a/src/regolith/tests/outputs/annual-activity/sbillinge.bib b/tests/outputs/annual-activity/sbillinge.bib similarity index 100% rename from src/regolith/tests/outputs/annual-activity/sbillinge.bib rename to tests/outputs/annual-activity/sbillinge.bib diff --git a/src/regolith/tests/outputs/beamplan/2020-1-XPD.tex b/tests/outputs/beamplan/2020-1-XPD.tex similarity index 100% rename from src/regolith/tests/outputs/beamplan/2020-1-XPD.tex rename to tests/outputs/beamplan/2020-1-XPD.tex diff --git a/src/regolith/tests/outputs/beamplan/2020-1-XPD.txt b/tests/outputs/beamplan/2020-1-XPD.txt similarity index 100% rename from src/regolith/tests/outputs/beamplan/2020-1-XPD.txt rename to tests/outputs/beamplan/2020-1-XPD.txt diff --git a/src/regolith/tests/outputs/current-pending/current-pending-ergs-scopatz.tex b/tests/outputs/current-pending/current-pending-ergs-scopatz.tex similarity index 100% rename from src/regolith/tests/outputs/current-pending/current-pending-ergs-scopatz.tex rename to tests/outputs/current-pending/current-pending-ergs-scopatz.tex diff --git a/src/regolith/tests/outputs/cv/scopatz.bib b/tests/outputs/cv/scopatz.bib similarity index 100% rename from src/regolith/tests/outputs/cv/scopatz.bib rename to tests/outputs/cv/scopatz.bib diff --git a/src/regolith/tests/outputs/cv/scopatz.tex b/tests/outputs/cv/scopatz.tex similarity index 100% rename from src/regolith/tests/outputs/cv/scopatz.tex rename to tests/outputs/cv/scopatz.tex diff --git a/src/regolith/tests/outputs/f_prum/projecta.yaml b/tests/outputs/f_prum/projecta.yaml similarity index 100% rename from src/regolith/tests/outputs/f_prum/projecta.yaml rename to tests/outputs/f_prum/projecta.yaml diff --git a/src/regolith/tests/outputs/f_todo/todos.yaml b/tests/outputs/f_todo/todos.yaml similarity index 100% rename from src/regolith/tests/outputs/f_todo/todos.yaml rename to tests/outputs/f_todo/todos.yaml diff --git a/src/regolith/tests/outputs/figure/figure_rend.tex b/tests/outputs/figure/figure_rend.tex similarity index 100% rename from src/regolith/tests/outputs/figure/figure_rend.tex rename to tests/outputs/figure/figure_rend.tex diff --git a/src/regolith/tests/outputs/formalletter/first_letter_nc.tex b/tests/outputs/formalletter/first_letter_nc.tex similarity index 100% rename from src/regolith/tests/outputs/formalletter/first_letter_nc.tex rename to tests/outputs/formalletter/first_letter_nc.tex diff --git a/src/regolith/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt b/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt similarity index 100% rename from src/regolith/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt rename to tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt diff --git a/src/regolith/tests/outputs/helper/proposalReviews.yml b/tests/outputs/helper/proposalReviews.yml similarity index 100% rename from src/regolith/tests/outputs/helper/proposalReviews.yml rename to tests/outputs/helper/proposalReviews.yml diff --git a/src/regolith/tests/outputs/html/.nojekyll b/tests/outputs/html/.nojekyll similarity index 100% rename from src/regolith/tests/outputs/html/.nojekyll rename to tests/outputs/html/.nojekyll diff --git a/src/regolith/tests/outputs/html/abstracts/Mouginot.Model.html b/tests/outputs/html/abstracts/Mouginot.Model.html similarity index 100% rename from src/regolith/tests/outputs/html/abstracts/Mouginot.Model.html rename to tests/outputs/html/abstracts/Mouginot.Model.html diff --git a/src/regolith/tests/outputs/html/blog/index.html b/tests/outputs/html/blog/index.html similarity index 100% rename from src/regolith/tests/outputs/html/blog/index.html rename to tests/outputs/html/blog/index.html diff --git a/src/regolith/tests/outputs/html/blog/my-vision.html b/tests/outputs/html/blog/my-vision.html similarity index 100% rename from src/regolith/tests/outputs/html/blog/my-vision.html rename to tests/outputs/html/blog/my-vision.html diff --git a/src/regolith/tests/outputs/html/blog/rss.xml b/tests/outputs/html/blog/rss.xml similarity index 100% rename from src/regolith/tests/outputs/html/blog/rss.xml rename to tests/outputs/html/blog/rss.xml diff --git a/src/regolith/tests/outputs/html/former/index.html b/tests/outputs/html/former/index.html similarity index 100% rename from src/regolith/tests/outputs/html/former/index.html rename to tests/outputs/html/former/index.html diff --git a/src/regolith/tests/outputs/html/group.bib b/tests/outputs/html/group.bib similarity index 100% rename from src/regolith/tests/outputs/html/group.bib rename to tests/outputs/html/group.bib diff --git a/src/regolith/tests/outputs/html/index.html b/tests/outputs/html/index.html similarity index 100% rename from src/regolith/tests/outputs/html/index.html rename to tests/outputs/html/index.html diff --git a/src/regolith/tests/outputs/html/jobs/0004.html b/tests/outputs/html/jobs/0004.html similarity index 100% rename from src/regolith/tests/outputs/html/jobs/0004.html rename to tests/outputs/html/jobs/0004.html diff --git a/src/regolith/tests/outputs/html/jobs/index.html b/tests/outputs/html/jobs/index.html similarity index 100% rename from src/regolith/tests/outputs/html/jobs/index.html rename to tests/outputs/html/jobs/index.html diff --git a/src/regolith/tests/outputs/html/people/index.html b/tests/outputs/html/people/index.html similarity index 100% rename from src/regolith/tests/outputs/html/people/index.html rename to tests/outputs/html/people/index.html diff --git a/src/regolith/tests/outputs/html/people/sbillinge.bib b/tests/outputs/html/people/sbillinge.bib similarity index 100% rename from src/regolith/tests/outputs/html/people/sbillinge.bib rename to tests/outputs/html/people/sbillinge.bib diff --git a/src/regolith/tests/outputs/html/people/sbillinge.html b/tests/outputs/html/people/sbillinge.html similarity index 100% rename from src/regolith/tests/outputs/html/people/sbillinge.html rename to tests/outputs/html/people/sbillinge.html diff --git a/src/regolith/tests/outputs/html/people/scopatz.bib b/tests/outputs/html/people/scopatz.bib similarity index 100% rename from src/regolith/tests/outputs/html/people/scopatz.bib rename to tests/outputs/html/people/scopatz.bib diff --git a/src/regolith/tests/outputs/html/people/scopatz.html b/tests/outputs/html/people/scopatz.html similarity index 100% rename from src/regolith/tests/outputs/html/people/scopatz.html rename to tests/outputs/html/people/scopatz.html diff --git a/src/regolith/tests/outputs/html/projects.html b/tests/outputs/html/projects.html similarity index 100% rename from src/regolith/tests/outputs/html/projects.html rename to tests/outputs/html/projects.html diff --git a/src/regolith/tests/outputs/internalhtml/.nojekyll b/tests/outputs/internalhtml/.nojekyll similarity index 100% rename from src/regolith/tests/outputs/internalhtml/.nojekyll rename to tests/outputs/internalhtml/.nojekyll diff --git a/src/regolith/tests/outputs/internalhtml/grpmeetings.html b/tests/outputs/internalhtml/grpmeetings.html similarity index 100% rename from src/regolith/tests/outputs/internalhtml/grpmeetings.html rename to tests/outputs/internalhtml/grpmeetings.html diff --git a/src/regolith/tests/outputs/internalhtml/intindex.html b/tests/outputs/internalhtml/intindex.html similarity index 100% rename from src/regolith/tests/outputs/internalhtml/intindex.html rename to tests/outputs/internalhtml/intindex.html diff --git a/src/regolith/tests/outputs/preslist/presentations-ergs-scopatz.tex b/tests/outputs/preslist/presentations-ergs-scopatz.tex similarity index 100% rename from src/regolith/tests/outputs/preslist/presentations-ergs-scopatz.tex rename to tests/outputs/preslist/presentations-ergs-scopatz.tex diff --git a/src/regolith/tests/outputs/publist/scopatz.bib b/tests/outputs/publist/scopatz.bib similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz.bib rename to tests/outputs/publist/scopatz.bib diff --git a/src/regolith/tests/outputs/publist/scopatz.tex b/tests/outputs/publist/scopatz.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz.tex rename to tests/outputs/publist/scopatz.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_ackno.bib b/tests/outputs/publist/scopatz_ackno.bib similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_ackno.bib rename to tests/outputs/publist/scopatz_ackno.bib diff --git a/src/regolith/tests/outputs/publist/scopatz_ackno.tex b/tests/outputs/publist/scopatz_ackno.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_ackno.tex rename to tests/outputs/publist/scopatz_ackno.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii.tex b/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii.tex rename to tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_ackno.tex b/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_ackno.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_ackno.tex rename to tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_ackno.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_nobold.tex b/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_nobold.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_nobold.tex rename to tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_nobold.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_pandoc.tex b/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_pandoc.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_pandoc.tex rename to tests/outputs/publist/scopatz_from2016-01-01_to2018-12-01_facility_nslsii_pandoc.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_nobold.bib b/tests/outputs/publist/scopatz_nobold.bib similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_nobold.bib rename to tests/outputs/publist/scopatz_nobold.bib diff --git a/src/regolith/tests/outputs/publist/scopatz_nobold.tex b/tests/outputs/publist/scopatz_nobold.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_nobold.tex rename to tests/outputs/publist/scopatz_nobold.tex diff --git a/src/regolith/tests/outputs/publist/scopatz_pandoc.tex b/tests/outputs/publist/scopatz_pandoc.tex similarity index 100% rename from src/regolith/tests/outputs/publist/scopatz_pandoc.tex rename to tests/outputs/publist/scopatz_pandoc.tex diff --git a/src/regolith/tests/outputs/recent-collabs/scopatz_doe.xlsx b/tests/outputs/recent-collabs/scopatz_doe.xlsx similarity index 100% rename from src/regolith/tests/outputs/recent-collabs/scopatz_doe.xlsx rename to tests/outputs/recent-collabs/scopatz_doe.xlsx diff --git a/src/regolith/tests/outputs/recent-collabs/scopatz_nsf.xlsx b/tests/outputs/recent-collabs/scopatz_nsf.xlsx similarity index 100% rename from src/regolith/tests/outputs/recent-collabs/scopatz_nsf.xlsx rename to tests/outputs/recent-collabs/scopatz_nsf.xlsx diff --git a/src/regolith/tests/outputs/reimb/test.xlsx b/tests/outputs/reimb/test.xlsx similarity index 100% rename from src/regolith/tests/outputs/reimb/test.xlsx rename to tests/outputs/reimb/test.xlsx diff --git a/src/regolith/tests/outputs/resume/scopatz.bib b/tests/outputs/resume/scopatz.bib similarity index 100% rename from src/regolith/tests/outputs/resume/scopatz.bib rename to tests/outputs/resume/scopatz.bib diff --git a/src/regolith/tests/outputs/resume/scopatz.tex b/tests/outputs/resume/scopatz.tex similarity index 100% rename from src/regolith/tests/outputs/resume/scopatz.tex rename to tests/outputs/resume/scopatz.tex diff --git a/src/regolith/tests/outputs/review-man/1902nature_sbillinge_author.txt b/tests/outputs/review-man/1902nature_sbillinge_author.txt similarity index 100% rename from src/regolith/tests/outputs/review-man/1902nature_sbillinge_author.txt rename to tests/outputs/review-man/1902nature_sbillinge_author.txt diff --git a/src/regolith/tests/outputs/review-man/1902nature_sbillinge_editor.txt b/tests/outputs/review-man/1902nature_sbillinge_editor.txt similarity index 100% rename from src/regolith/tests/outputs/review-man/1902nature_sbillinge_editor.txt rename to tests/outputs/review-man/1902nature_sbillinge_editor.txt diff --git a/src/regolith/tests/outputs/review-prop/1906doeExample_sbillinge.txt b/tests/outputs/review-prop/1906doeExample_sbillinge.txt similarity index 100% rename from src/regolith/tests/outputs/review-prop/1906doeExample_sbillinge.txt rename to tests/outputs/review-prop/1906doeExample_sbillinge.txt diff --git a/src/regolith/tests/outputs/review-prop/1906nsfExample_sbillinge.txt b/tests/outputs/review-prop/1906nsfExample_sbillinge.txt similarity index 100% rename from src/regolith/tests/outputs/review-prop/1906nsfExample_sbillinge.txt rename to tests/outputs/review-prop/1906nsfExample_sbillinge.txt diff --git a/src/regolith/tests/outputs/u_contact/contacts.yaml b/tests/outputs/u_contact/contacts.yaml similarity index 100% rename from src/regolith/tests/outputs/u_contact/contacts.yaml rename to tests/outputs/u_contact/contacts.yaml diff --git a/src/regolith/tests/outputs/u_institutions/institutions.yaml b/tests/outputs/u_institutions/institutions.yaml similarity index 100% rename from src/regolith/tests/outputs/u_institutions/institutions.yaml rename to tests/outputs/u_institutions/institutions.yaml diff --git a/src/regolith/tests/outputs/u_logurl/projecta.yaml b/tests/outputs/u_logurl/projecta.yaml similarity index 100% rename from src/regolith/tests/outputs/u_logurl/projecta.yaml rename to tests/outputs/u_logurl/projecta.yaml diff --git a/src/regolith/tests/outputs/u_milestone/projecta.yaml b/tests/outputs/u_milestone/projecta.yaml similarity index 100% rename from src/regolith/tests/outputs/u_milestone/projecta.yaml rename to tests/outputs/u_milestone/projecta.yaml diff --git a/src/regolith/tests/outputs/u_todo/todos.yaml b/tests/outputs/u_todo/todos.yaml similarity index 100% rename from src/regolith/tests/outputs/u_todo/todos.yaml rename to tests/outputs/u_todo/todos.yaml diff --git a/src/regolith/tests/test_broker.py b/tests/test_broker.py similarity index 100% rename from src/regolith/tests/test_broker.py rename to tests/test_broker.py diff --git a/src/regolith/tests/test_builders.py b/tests/test_builders.py similarity index 99% rename from src/regolith/tests/test_builders.py rename to tests/test_builders.py index 9db944aec..3fbb61809 100644 --- a/src/regolith/tests/test_builders.py +++ b/tests/test_builders.py @@ -149,7 +149,7 @@ def test_builder(bm, db_src, make_db, make_mongodb, monkeypatch): for testfile in test_files: if testfile.name not in output_filenames: print( - f"Expected test file {testfile} not generated by the builder." f"Files genereated: {output_files}" + f"Expected test file {testfile} not generated by the builder." f"Files generated: {output_files}" ) assert False # for all other test output 'expected' files check they are the same as the program output @@ -280,7 +280,7 @@ def mockreturn(*args, **kwargs): for testfile in test_files: if testfile.name not in output_filenames: print( - f"Expected test file {testfile} not generated by the builder." f"Files genereated: {output_files}" + f"Expected test file {testfile} not generated by the builder." f"Files generated: {output_files}" ) assert False # for all other test output 'expected' files check they are the same as the program output diff --git a/src/regolith/tests/test_chain_db.py b/tests/test_chain_db.py similarity index 100% rename from src/regolith/tests/test_chain_db.py rename to tests/test_chain_db.py diff --git a/src/regolith/tests/test_client_manager.py b/tests/test_client_manager.py similarity index 100% rename from src/regolith/tests/test_client_manager.py rename to tests/test_client_manager.py diff --git a/src/regolith/tests/test_commands.py b/tests/test_commands.py similarity index 96% rename from src/regolith/tests/test_commands.py rename to tests/test_commands.py index e0a2cc77a..34f5b1751 100644 --- a/src/regolith/tests/test_commands.py +++ b/tests/test_commands.py @@ -12,7 +12,10 @@ from regolith.main import main from regolith.mongoclient import load_mongo_col from regolith.runcontrol import DEFAULT_RC, load_rcfile -from regolith.tests.conftest import ALTERNATE_REGOLITH_MONGODB_NAME, FS_DB_NAME + +# from regolith.tests.conftest import ALTERNATE_REGOLITH_MONGODB_NAME, FS_DB_NAME +# comment this out because pytest automatically imports conftest + BILLINGE_TEST = False # special tests for Billinge group, switch it to False before push to remote diff --git a/src/regolith/tests/test_dates.py b/tests/test_dates.py similarity index 100% rename from src/regolith/tests/test_dates.py rename to tests/test_dates.py diff --git a/src/regolith/tests/test_fsclient.py b/tests/test_fsclient.py similarity index 100% rename from src/regolith/tests/test_fsclient.py rename to tests/test_fsclient.py diff --git a/src/regolith/tests/test_helpers.py b/tests/test_helpers.py similarity index 100% rename from src/regolith/tests/test_helpers.py rename to tests/test_helpers.py diff --git a/src/regolith/tests/test_main.py b/tests/test_main.py similarity index 100% rename from src/regolith/tests/test_main.py rename to tests/test_main.py diff --git a/src/regolith/tests/test_runcontrol.py b/tests/test_runcontrol.py similarity index 100% rename from src/regolith/tests/test_runcontrol.py rename to tests/test_runcontrol.py diff --git a/src/regolith/tests/test_schemas.py b/tests/test_schemas.py similarity index 100% rename from src/regolith/tests/test_schemas.py rename to tests/test_schemas.py diff --git a/src/regolith/tests/test_storage.py b/tests/test_storage.py similarity index 100% rename from src/regolith/tests/test_storage.py rename to tests/test_storage.py diff --git a/src/regolith/tests/test_tools.py b/tests/test_tools.py similarity index 100% rename from src/regolith/tests/test_tools.py rename to tests/test_tools.py diff --git a/src/regolith/tests/test_validate.py b/tests/test_validate.py similarity index 100% rename from src/regolith/tests/test_validate.py rename to tests/test_validate.py diff --git a/src/regolith/tests/test_validators.py b/tests/test_validators.py similarity index 100% rename from src/regolith/tests/test_validators.py rename to tests/test_validators.py