tests: use os.rename instead of os.replace in lttng_live_server.py
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 1 Oct 2019 22:22:10 +0000 (18:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Oct 2019 14:45:11 +0000 (10:45 -0400)
commit10b3a222a8ef74029f6b4d05818437ba0de743d6
tree1dab0991b5dd96caa8fc3f9c968ad136f60060df
parentf5e4e7f6e9ade2e1b9e2ef6b7e6d55d19f16a85c
tests: use os.rename instead of os.replace in lttng_live_server.py

On Windows, os.rename fails if the destination file exists, which is the
case for the port file in lttng_live_server.py.  The file is created by
the bash test script.

This results in the following error:

    # Starting LTTng live server mockup
    Traceback (most recent call last):
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1449, in <module>
        args.port_filename, args.sessions, args.max_query_data_response_size
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1229, in __init__
        self._write_port_to_file(port_filename)
      File "C:/Users/smarchi/babeltrace/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py", line 1342, in _write_port_to_file
        os.rename(tmp_port_file.name, port_filename)
    FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:/Users/smarchi/AppData/Local/Temp/tmpi8ihb0ck' -> 'test_live_list_sessions_server_port.5iod4m'

Use os.replace instead.

Change-Id: I8d7a28da66f11975bb0e2d355084a8a336500cc0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2113
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py
This page took 0.025502 seconds and 4 git commands to generate.