diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2db4c24..6e2efd8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,10 +10,10 @@ jobs: fail-fast: false matrix: python-version: - - 3.7 - 3.8 - 3.9 - '3.10' + - '3.11' steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/.pylintrc b/.pylintrc index ef018ce..89597ef 100644 --- a/.pylintrc +++ b/.pylintrc @@ -65,86 +65,7 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use "--disable=all --enable=classes # --disable=W". -disable=print-statement, - parameter-unpacking, - unpacking-in-except, - old-raise-syntax, - backtick, - long-suffix, - old-ne-operator, - old-octal-literal, - import-star-module-level, - non-ascii-bytes-literal, - raw-checker-failed, - bad-inline-option, - locally-disabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - use-symbolic-message-instead, - apply-builtin, - basestring-builtin, - buffer-builtin, - cmp-builtin, - coerce-builtin, - execfile-builtin, - file-builtin, - long-builtin, - raw_input-builtin, - reduce-builtin, - standarderror-builtin, - unicode-builtin, - xrange-builtin, - coerce-method, - delslice-method, - getslice-method, - setslice-method, - no-absolute-import, - old-division, - dict-iter-method, - dict-view-method, - next-method-called, - metaclass-assignment, - indexing-exception, - raising-string, - reload-builtin, - oct-method, - hex-method, - nonzero-method, - cmp-method, - input-builtin, - round-builtin, - intern-builtin, - unichr-builtin, - map-builtin-not-iterating, - zip-builtin-not-iterating, - range-builtin-not-iterating, - filter-builtin-not-iterating, - using-cmp-argument, - eq-without-hash, - div-method, - idiv-method, - rdiv-method, - exception-message-attribute, - invalid-str-codec, - sys-max-int, - bad-python3-import, - deprecated-string-function, - deprecated-str-translate-call, - deprecated-itertools-function, - deprecated-types-field, - next-method-defined, - dict-items-not-iterating, - dict-keys-not-iterating, - dict-values-not-iterating, - deprecated-operator-function, - deprecated-urllib-function, - xreadlines-attribute, - deprecated-sys-function, - exception-escape, - comprehension-escape, - logging-fstring-interpolation, +disable=logging-fstring-interpolation, missing-module-docstring, missing-class-docstring, missing-function-docstring, @@ -594,5 +515,5 @@ min-public-methods=2 # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException, + builtins.Exception diff --git a/pydc_control/commands.py b/pydc_control/commands.py index de304c3..103db22 100644 --- a/pydc_control/commands.py +++ b/pydc_control/commands.py @@ -243,9 +243,14 @@ def run_checkout(args: argparse.Namespace): continue if os.path.exists(project.path): - log.get_logger().info(f'########### {project.name} (pulling changes) ###########') - commands = ['git', 'pull', 'upstream', 'master'] cwd = project.path + head_branch = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD'], + encoding='utf8', + cwd=cwd, + ).strip() + log.get_logger().info(f'########### {project.name} (pulling changes for {head_branch}) ###########') + commands = ['git', 'pull', 'upstream', head_branch] else: log.get_logger().info(f'########### {project.name} (cloning) ###########') commands = ['git', 'clone', '--origin', 'upstream', project.repository] diff --git a/pydc_control/docker_utils.py b/pydc_control/docker_utils.py index 4c85ed8..f2d7fab 100644 --- a/pydc_control/docker_utils.py +++ b/pydc_control/docker_utils.py @@ -68,7 +68,7 @@ def is_port_open(port): def _is_path_responding(port: int, path: str) -> bool: with contextlib.suppress(Exception): - return requests.get(f'http://localhost:{port}{path}').status_code == 200 + return requests.get(f'http://localhost:{port}{path}', timeout=30).status_code == 200 def check_port(container_name: str, port: int, path: str) -> None: diff --git a/pydc_control/test/test_integration.py b/pydc_control/test/test_integration.py index a4407d4..005043b 100644 --- a/pydc_control/test/test_integration.py +++ b/pydc_control/test/test_integration.py @@ -35,6 +35,7 @@ def _run_control_commands(args: List[str], working_dir: Optional[str] = None) -> os.chdir(working_dir) exit_code = pydc_control.run(SAMPLE_CONTROL_BASE_DIR, args=args) if exit_code: + # pylint: disable=broad-exception-raised raise Exception(f'Could not startup sample project due to exit code: {exit_code}') if working_dir: os.chdir(original_working_dir) diff --git a/setup.py b/setup.py index 3501b5f..07a30cf 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import subprocess -MAJOR_VERSION = '1' +MAJOR_VERSION = '2' version_file = os.path.join(os.path.dirname(__file__), 'pydc_control/VERSION') diff --git a/test_requirements.in b/test_requirements.in new file mode 100644 index 0000000..a80184c --- /dev/null +++ b/test_requirements.in @@ -0,0 +1,9 @@ +pytest>=6.2.4 +pytest-randomly>=3.10.1 +pytest-cov>=2.12.1 +pylint>=2.16.2 +pylintfileheader>=0.3.0 +pycodestyle>=2.8.0 +# Lock major version only +docker<7 +tox-pyenv diff --git a/test_requirements.txt b/test_requirements.txt index 9b58e2d..d00762e 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,9 +1,119 @@ -pytest==6.2.4 -pytest-randomly==3.10.1 -pytest-cov==2.12.1 -pylint==2.10.2 -pylintfileheader==0.3.0 -pycodestyle==2.8.0 -# Lock major version only -docker<6 -tox-pyenv +# +# This file is autogenerated by pip-compile with python 3.7 +# To update, run: +# +# pip-compile test_requirements.in +# +astroid==2.15.8 + # via pylint +cachetools==5.3.2 + # via tox +certifi==2023.11.17 + # via requests +chardet==5.2.0 + # via tox +charset-normalizer==3.3.2 + # via requests +colorama==0.4.6 + # via tox +coverage[toml]==7.2.7 + # via pytest-cov +dill==0.3.7 + # via pylint +distlib==0.3.8 + # via virtualenv +docker==6.1.3 + # via -r test_requirements.in +exceptiongroup==1.2.0 + # via pytest +filelock==3.12.2 + # via + # tox + # virtualenv +idna==3.6 + # via requests +importlib-metadata==6.7.0 + # via + # pluggy + # pytest + # pytest-randomly + # tox + # virtualenv +iniconfig==2.0.0 + # via pytest +isort==5.11.5 + # via pylint +lazy-object-proxy==1.9.0 + # via astroid +mccabe==0.7.0 + # via pylint +packaging==23.2 + # via + # docker + # pyproject-api + # pytest + # tox +platformdirs==4.0.0 + # via + # pylint + # tox + # virtualenv +pluggy==1.2.0 + # via + # pytest + # tox +pycodestyle==2.10.0 + # via -r test_requirements.in +pylint==2.17.7 + # via + # -r test_requirements.in + # pylintfileheader +pylintfileheader==0.3.3 + # via -r test_requirements.in +pyproject-api==1.5.3 + # via tox +pytest==7.4.3 + # via + # -r test_requirements.in + # pytest-cov + # pytest-randomly +pytest-cov==4.1.0 + # via -r test_requirements.in +pytest-randomly==3.12.0 + # via -r test_requirements.in +requests==2.31.0 + # via docker +tomli==2.0.1 + # via + # coverage + # pylint + # pyproject-api + # pytest + # tox +tomlkit==0.12.3 + # via pylint +tox==4.8.0 + # via tox-pyenv +tox-pyenv==1.1.0 + # via -r test_requirements.in +typed-ast==1.5.5 + # via astroid +typing-extensions==4.7.1 + # via + # astroid + # importlib-metadata + # platformdirs + # pylint + # tox +urllib3==2.0.7 + # via + # docker + # requests +virtualenv==20.25.0 + # via tox +websocket-client==1.6.1 + # via docker +wrapt==1.16.0 + # via astroid +zipp==3.15.0 + # via importlib-metadata