-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python package with expanded testing (#278)
* Code reorganization to address #273 * Fixed issues with renaming config_file as registry * Removed a print statement left in by mistake * On our way to more robust testing * Added nocolor option to 'git branch list' * It's enough to chdir to the fixture dir at the beginning of a test * Added 'mepo branch' tests * Added tests for mepo tag, fetch, pull, pull-all * multiprocessing library supports the context management protocol * Added tests for mepo push, diff, whereis and reset * component.py - using Python3's relative import * Suppressing test outputs to terminal * Turning off testing 'mepo reset' and checking why 'mepo diff' is failing Maybe 'mepo reset' is causing issues with testing 'mepo tag create' * For testing 'mepo diff', ignore the last line '---' * Ignore the last line of both stdout and saved outputs * Escaping the string message of 'git tag create' * Create regular (non-annotated) tag instead * Testing 'mepo reset' is back on - this was not the issue * Code from src/mepo/command/command.py included in src/mepo/__main__.py * Small edits * Updated GEOSfvdycore version for testing * Minor quote changes * Using SimpleNamespace to construct arguments to mepo commands * Multiprocessing lib supports context manager protocol * Removed tests/input/args.py - using SimpleNamespace now * Updated README and CHANGELOG * Moved duplicate code to get GIT_EDITOR, in commit.py and tag_create.py, to git.py * Lint code as part of GitHub actions workflow only for the case where OS is ubuntu-latest and Python version is 3.9 * Added __init__.py in cmdline, command and utilities directories * Linting updates 1. Linting is a separate job now 2. Disabling some error codes, for now 3. Always return a zero status code * Hardcoding Python version * Renaming * Adding ability to create a mepo binary that can uploaded as an artifact of a Github actions workflow. Pyinstaller requires that the top level script not use relative imports * Added fix for reading mepo1 state * Added a mepo command, update-state, to permanently update mepo1 state to mepo2 * Formatting changes to update-state.py * Slightly different printable representation of component * Added an optional argument one-per-line for 'list' * component.py::MepoComponent - renamed to_dict to to_registry_format. Added to_dict * Fixed test test_list * Fixed a bug in update-state - need to switch to the fixture dir first * Implemented a context manager for os.chdir * Reformatted using black * Separate GitHub workflows for running linter and formatter * Added black to requirements * Using poetry to manage dependencies and packaging * Added creation of a top level script to build * Added pylint as (poetry) dependency * Added pylint to requirements.txt * Updated pyproject.toml * Small changes to the test script for consistency in mepo commands * Enabled previously disabled Pylint (C)onvention and (E)rror codes * Added directory containing mepo to PYTHONPATH * Using contextlib.redirect_stdout instead * Can't switch to contextlib.chdir as this exists only in 3.11+ * Run 'black --check' instead. Non-zero return code indicates that some files need to be formatted * Formatted using black * Config file is now called registry * Moved fixture/component validation from MepoComponent to Registry * Reformat using black * Switched from pkl state file to json * print() has a flush argument * Trivial changes * If mepo1 style state, print warning to run 'mepo update-state'. Updated update-state code. * Removing hashes from requirements.txt * Fixed bug in string formatting * Update comment in registry.py * Store full path to the fixture dir in state file * Revert "Store full path to the fixture dir in state file". We want relocability. This reverts commit 1bc8330. * Local path saved to state file is relative to fixture directory
- Loading branch information
1 parent
1afb682
commit 53ffe8a
Showing
112 changed files
with
3,249 additions
and
2,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Run formatter | ||
|
||
on: [push] | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
name: Format code | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
timeout-minutes: 5 | ||
- name: Run black | ||
run: black --check . | ||
timeout-minutes: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Run linter | ||
|
||
on: [push] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
name: Lint code | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
timeout-minutes: 5 | ||
- name: Run pylint | ||
run: pylint --exit-zero src/mepo | ||
timeout-minutes: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
import os | ||
import glob | ||
|
||
cmd_dir = os.path.join(SPECPATH, 'src/mepo/command') | ||
cmd_list = [os.path.basename(x).split('.')[0] for x in glob.glob(os.path.join(cmd_dir, '*.py'))] | ||
hidden_imports = [f'mepo.command.{x}' for x in cmd_list if '_' not in x] # exclude subcommands | ||
print(f'hidden_imports: {hidden_imports}') | ||
|
||
a = Analysis( | ||
['src/mepo/__main__.py'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[], | ||
hiddenimports=hidden_imports, | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
noarchive=False, | ||
optimize=0, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='mepo', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='mepo', | ||
) |
Oops, something went wrong.