Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Update CI tests #126

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Update CI tests #126

wants to merge 10 commits into from

Conversation

rffontenelle
Copy link

I started with some GitHub Actions versions update and went on fixing stuff and enabling others, so I'm submitting for you consideration and see if anything else should be changed.

Heads up: errors popped up.

Summary of my changes:

  • Updated actions/checkout and actions/setup-python to latest versions (post-nodejs v12 deprecation in github actions)
  • Enabled added workflow_dispatch even trigger (allows manual start of the test), disabled fail-fast (run all matrix strategies, do not cancel all if one fail), enabled max-parallel 5 (to not run all matrix combinations at once)
  • Enable Python 3.11 in tox and CI to pop up errors, and looks like I found
  • Enable Python 3.10 in CI (was in tox already)
  • Reorganize matrix.tox values; GitHub workflow editor was complaining that "matrix values must contain primitive values", so replaced 'tox' (py_version and env) with 'py_version' including 'env'
  • Run flake8, mypy and black envs in all Python versions, instead of Python 3.8 only

Issues brought up:

  • ubuntu-latest image (now 22.04) does not support Python 3.6 — note this doesn't affect macos-latest (yet);
  • flake8 fails in all but Python 3.7 and 3.6 (only macos-latest due to above issue)
  • Python 3.11 fails in "test_exclude_directory" test (both ubuntu and macos)

Error outputs:

Click for flake8 error output.
 ERROR: invocation failed (exit code 1), logfile: /home/runner/work/Potodo/Potodo/.tox/flake8/log/flake8-0.log
================================== log start ===================================
Traceback (most recent call last):
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/bin/flake8", line 8, in 
    sys.exit(main())
             ^^^^^^
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
                                 ^^^^^^^^^^^^^^^^
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/options/parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/Potodo/Potodo/.tox/flake8/lib/python3.11/site-packages/flake8/options/config.py", line 131, in parse_config
    raise ValueError(
ValueError: Error code '#' supplied to 'extend-ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'
ERROR: InvocationError for command /home/runner/work/Potodo/Potodo/.tox/flake8/bin/flake8 tests/ potodo/ (exited with code 1)
Click for py311 error output.
ERROR: invocation failed (exit code 1), logfile: /home/runner/work/Potodo/Potodo/.tox/py311/log/py311-0.log
================================== log start ===================================
============================= test session starts ==============================
platform linux -- Python 3.11.0, pytest-7.2.0, pluggy-1.0.0
cachedir: .tox/py311/.pytest_cache
rootdir: /home/runner/work/Potodo/Potodo
collected 20 items

tests/test_exclude.py ..F. [ 20%]
tests/test_potodo.py .. [ 30%]
tests/test_potodo_args_errors.py ..... [ 55%]
tests/test_potodo_default_args.py ......... [100%]

=================================== FAILURES ===================================
____________________________ test_exclude_directory ____________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7fb6fa785c10>
base_config = {'above': 0, 'below': 100, 'counts': False, 'exclude': ['excluded/*'], ...}

def test_exclude_directory(capsys, base_config):
    base_config["exclude"] = ["excluded/*"]
  exec_potodo(**base_config)

tests/test_exclude.py:26:


potodo/potodo.py:203: in exec_potodo
non_interactive_output(
potodo/potodo.py:88: in non_interactive_output
po_files_and_dirs = get_po_stats_from_repo_or_cache(path, ignore_matches, no_cache)
potodo/po_file.py:82: in get_po_stats_from_repo_or_cache
all_po_files: List[Path] = [
potodo/po_file.py:83: in
file for file in repo_path.rglob("*.po") if not ignore_matches(str(file))
potodo/potodo.py:155: in
return lambda file_path: any(r.match(file_path) for r in rules)
potodo/potodo.py:155: in
return lambda file_path: any(r.match(file_path) for r in rules)
.tox/py311/lib/python3.11/site-packages/gitignore_parser.py:147: in match
if re.search(self.regex, rel_path):
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/init.py:176: in search
return _compile(pattern, flags).search(string)
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/init.py:294: in _compile
p = _compiler.compile(pattern, flags)
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/_compiler.py:743: in compile
p = _parser.parse(p, flags)
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/_parser.py:980: in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/_parser.py:455: in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,


source = <re._parser.Tokenizer object at 0x7fb6fa7b6a10>
state = <re._parser.State object at 0x7fb6fa7c00d0>, verbose = 0, nested = 1
first = True

def _parse(source, state, verbose, nested, first=False):
    # parse a simple pattern
    subpattern = SubPattern(state)

                            import warnings
                            warnings.warn(
                                "bad character in group name %s at position %d" %
                                (repr(condname) if source.istext else ascii(condname),
                                 source.tell() - len(condname) - 1),
                                DeprecationWarning, stacklevel=nested + 6
                            )
                    state.checklookbehindgroup(condgroup, source)
                    item_yes = _parse(source, state, verbose, nested + 1)
                    if source.match("|"):
                        item_no = _parse(source, state, verbose, nested + 1)
                        if source.next == "|":
                            raise source.error("conditional backref with more than two branches")
                    else:
                        item_no = None
                    if not source.match(")"):
                        raise source.error("missing ), unterminated subpattern",
                                           source.tell() - start)
                    subpatternappend((GROUPREF_EXISTS, (condgroup, item_yes, item_no)))
                    continue

                elif char == ">":
                    # non-capturing, atomic group
                    capture = False
                    atomic = True
                elif char in FLAGS or char == "-":
                    # flags
                    flags = _parse_flags(source, state, char)
                    if flags is None:  # global flags
                        if not first or subpattern:
                          raise source.error('global flags not at the start '
                                               'of the expression',
                                               source.tell() - start)

E re.error: global flags not at the start of the expression at position 1

/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/re/_parser.py:841: error
=========================== short test summary info ============================
FAILED tests/test_exclude.py::test_exclude_directory - re.error: global flags...
========================= 1 failed, 19 passed in 6.79s =========================
ERROR: InvocationError for command /home/runner/work/Potodo/Potodo/.tox/py311/bin/coverage run -m pytest (exited with code 1)

=================================== log end ====================================
✖ FAIL py311 in 24.09 seconds

(also attaching because the output was HTML-formatted a bit: py311.txt)

Ideas:

  • Want me to add 3.12-dev as well, to spot issues before next Python release?
  • Drop Python 3.6 (which is already EOL) tests ? (if yes, I'd recommend updating setup.cfg as well)

@Seluj78
Copy link
Collaborator

Seluj78 commented Nov 28, 2022

Want me to add 3.12-dev as well, to spot issues before next Python release?

I don't know to be honest. @JulienPalard, what do you think ?

Drop Python 3.6 (which is already EOL) tests ? (if yes, I'd recommend updating setup.cfg as well)

I think this is a good idea though.

Copy link
Collaborator

@Seluj78 Seluj78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good in my eyes 👌 👀

@rffontenelle
Copy link
Author

Just to complement, my idea regarding 3.12-dev is to use https://github.com/deadsnakes/action (its README has the syntax: if suffix has -dev then run deadsnakes's Python image)

Also, it seems 1 workflow awaiting approval is require. You may want to do it so the tests are run.

@JulienPalard
Copy link
Collaborator

Thanks a lot @rffontenelle!

Don't worry about enhancing too much the .github/workflow (the 3.12 thing via deadsnakes) as this repo will probably move soon out of github (we're moving to our https://git.afpy.org that we've opened because we're less and less happy to produce open-source using a close-source tool, here, at the AFPy).

@rffontenelle
Copy link
Author

rffontenelle commented Nov 29, 2022

@JulienPalard does this apply to all poutils-related software?

@JulienPalard
Copy link
Collaborator

@JulienPalard does this apply to all poutils-related software?

It applies to all poutils-related software hosted under https://github.com/AFPy/Potodo, yes.

Ultimately it could apply to all repositories under https://github.com/AFPy (I don't see the point of keeping our open-source code in a close-source environment now that we have a self-hosted open-source alternative).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants