vedro-universe / vedro-allure-reporter

Allure reporter for Vedro testing framework
https://vedro.io/docs/integrations/allure-reporter
Apache License 2.0
4 stars 3 forks source link

Get a bug error when test finished #12

Open ko10ok opened 1 month ago

ko10ok commented 1 month ago
make e2e-run args='scenarios/try_limit.py'
time docker-compose exec -T e2e /venv/bin/python3 bootstrap.py -r gitlab allure --gitlab-collapsable vars \
         --reruns 0 --allure-report-dir ./allure_reports scenarios/try_limit.py
Traceback (most recent call last):
  File "/home/ubuntu/workdir/bootstrap.py", line 5, in <module>
    vedro.run()
  File "/venv/lib/python3.10/site-packages/vedro/__init__.py", line 42, in run
    asyncio.run(main())
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/venv/lib/python3.10/site-packages/vedro/_main.py", line 44, in main
    await RunCommand(config, parser).run()
  File "/venv/lib/python3.10/site-packages/vedro/commands/run_command/_run_command.py", line 109, in run
    await self._parse_args(dispatcher)
  File "/venv/lib/python3.10/site-packages/vedro/commands/run_command/_run_command.py", line 97, in _parse_args
    await dispatcher.fire(ArgParsedEvent(args))
  File "/venv/lib/python3.10/site-packages/vedro/core/_dispatcher.py", line 65, in fire
    await handler(event)
  File "/venv/lib/python3.10/site-packages/vedro/core/_dispatcher.py", line 25, in __call__
    self._handler(event)
  File "/venv/lib/python3.10/site-packages/vedro_allure_reporter/_allure_reporter.py", line 104, in on_choosen_arg_parsed
    self._logger = self._logger_factory(self._report_dir, clean=True)
  File "/venv/lib/python3.10/site-packages/allure_commons/logger.py", line 18, in __init__
    shutil.rmtree(self._report_dir)
  File "/usr/local/lib/python3.10/shutil.py", line 730, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/local/lib/python3.10/shutil.py", line 728, in rmtree
    os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/home/ubuntu/workdir/allure_reports'

/venv/bin/python3 -m vedro version
Vedro 1.11.2
tsv1 commented 1 month ago

Hi,

The issue seems to be related to the AllureFileLogger, which is responsible for cleaning up the folder. The shutil.rmtree function occasionally produces a general OSError, likely due to a race condition.

A quick search indicates that this is a known issue in various contexts (1, 2).

Is the error reproducible consistently in your environment? Also, is the allure_reports directory potentially being accessed by another process, such as the Allure command-line tool?