From d49bfca815dd4bb2c8bd7d9e714553988376e5b2 Mon Sep 17 00:00:00 2001
From: Takashi Kajinami <kajinamit@oss.nttdata.com>
Date: Sat, 18 Jan 2025 14:53:34 +0900
Subject: [PATCH] Remove support for running unit tests in Windows

Support for Windows OS was already removed[1].

[1] 3df106fa34080ab32e9a1ee334c93e0df29b68e7

Change-Id: I8fef84147c2d409f3875a7bbad69a5bc0456fb2f
---
 oslo_concurrency/tests/unit/test_lockutils.py | 24 +++----------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/oslo_concurrency/tests/unit/test_lockutils.py b/oslo_concurrency/tests/unit/test_lockutils.py
index 993157b..9eeac35 100644
--- a/oslo_concurrency/tests/unit/test_lockutils.py
+++ b/oslo_concurrency/tests/unit/test_lockutils.py
@@ -14,6 +14,7 @@
 
 import collections
 import errno
+import fcntl
 import multiprocessing
 import os
 import signal
@@ -30,25 +31,6 @@ from oslo_concurrency.fixture import lockutils as fixtures
 from oslo_concurrency import lockutils
 from oslo_config import fixture as config
 
-if sys.platform == 'win32':
-    import msvcrt
-else:
-    import fcntl
-
-
-def lock_file(handle):
-    if sys.platform == 'win32':
-        msvcrt.locking(handle.fileno(), msvcrt.LK_NBLCK, 1)
-    else:
-        fcntl.flock(handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
-
-
-def unlock_file(handle):
-    if sys.platform == 'win32':
-        msvcrt.locking(handle.fileno(), msvcrt.LK_UNLCK, 1)
-    else:
-        fcntl.flock(handle, fcntl.LOCK_UN)
-
 
 def lock_files(handles_dir, out_queue):
     with lockutils.lock('external', 'test-', external=True):
@@ -65,9 +47,9 @@ def lock_files(handles_dir, out_queue):
         count = 0
         for handle in handles:
             try:
-                lock_file(handle)
+                fcntl.flock(handle, fcntl.LOCK_EX | fcntl.LOCK_NB)
                 count += 1
-                unlock_file(handle)
+                fcntl.flock(handle, fcntl.LOCK_UN)
             except OSError:
                 os._exit(2)
             finally: