Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qa-docs generator is not working properly on Windows #1930

Closed
jmv74211 opened this issue Sep 27, 2021 · 1 comment
Closed

qa-docs generator is not working properly on Windows #1930

jmv74211 opened this issue Sep 27, 2021 · 1 comment
Assignees

Comments

@jmv74211
Copy link
Contributor

When using qa-docs on Windows, I got the following error:

qa-docs.exe -e test_general_settings_enabled -I C:\Users\jmv74211\AppData\Local\Temp\wazuh-qa\tests

Traceback (most recent call last):
  File "C:\Users\jmv74211\venv\Scripts\qa-docs-script.py", line 33, in <module>
    sys.exit(load_entry_point('wazuh-testing==4.3.0', 'console_scripts', 'qa-docs')())
  File "C:\Users\jmv74211\venv\lib\site-packages\wazuh_testing-4.3.0-py3.9.egg\wazuh_testing\scripts\qa_docs.py", line 42, in main
    doc_check = DocGenerator(Config(CONFIG_PATH, args.test_dir, '', args.test_exist))
  File "C:\Users\jmv74211\venv\lib\site-packages\wazuh_testing-4.3.0-py3.9.egg\wazuh_testing\qa_docs\doc_generator.py", line 32, in __init__
    self.ignore_regex.append(re.compile(ignore_regex))
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\re.py", line 252, in compile
    return _compile(pattern, flags)
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\re.py", line 304, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 525, in _parse
    code = _escape(source, this, state)
  File "C:\Users\jmv74211\AppData\Local\Programs\Python\Python39\lib\sre_parse.py", line 381, in _escape
    raise source.error("incomplete escape %s" % escape, len(escape))
re.error: incomplete escape \U at position 2

It seems that the qa-docs parser does not works properly on Windows.

It is requested to investigate and fix this, in order to use qa-docs and integrate it with qa-ctl tool.

Regards.

mdengra added a commit that referenced this issue Sep 27, 2021
Replace backslash with the slash in the paths where
the input or output directory is specified.
It seems that from Python version 3.7 onwards
backslashes are interpreted as escape characters
by the re module.
This causes problems in Windows paths.

Closes: #1930
@mdengra
Copy link
Contributor

mdengra commented Sep 27, 2021

2021-09-27

After performing some testing, using the following paths does not cause any problems:
-C:\\Users\\jmv74211\\AppData\\Local\\Temp\\wazuh-qa\\tests
-C:/Users/jmv74211/AppData/Local/Temp/wazuh-qa/tests

It seems that from Python version 3.7 onwards, the re module interprets the backslash as an escape character, which causes errors when using Windows paths.
The fix has been to replace the backslashes with slashes in the paths used to specify the input and output directories in the config.py module of qa-docs.

mdengra added a commit that referenced this issue Sep 27, 2021
It seems that from Python version 3.7 onwards
backslashes are interpreted as escape characters
by the re module.
This causes problems in Windows paths.

Closes: #1930
roronoasins pushed a commit that referenced this issue Oct 4, 2021
Replace backslash with the slash in the paths where
the input or output directory is specified.
It seems that from Python version 3.7 onwards
backslashes are interpreted as escape characters
by the re module.
This causes problems in Windows paths.

Closes: #1930

Also, bc610a3 added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants