Skip to content

Commit

Permalink
fix(tests): make Windows-specific tests conditional
Browse files Browse the repository at this point in the history
Signed-off-by: SONIABHISHEK121 <[email protected]>
  • Loading branch information
ABHISHEKSONI121 committed Jul 10, 2024
1 parent 0d7ce70 commit ecb091e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/test_pyi25.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
import os
import sys
import pytest
import win32com.server.register
if sys.platform == 'win32':
import win32com.server.register
else:
win32com = None
import win32com.server.localserver


Expand Down Expand Up @@ -136,15 +139,19 @@ def test_DigitoVerificadorModulo10_large_number():
assert len(result) == 1 and result.isdigit()


@pytest.mark.skipif(sys.platform != 'win32', reason="Requires Windows")
def test_main_with_register(mocker):
mocker.patch("win32com.server.register.UseCommandLine")
sys.argv = ["pyi25.py", "--register"]
main()
win32com.server.register.UseCommandLine.assert_called_once_with(PyI25)
if win32com:
mocker.patch("win32com.server.register.UseCommandLine")
sys.argv = ["pyi25.py", "--register"]
main()
win32com.server.register.UseCommandLine.assert_called_once_with(PyI25)


@pytest.mark.skipif(sys.platform != 'win32', reason="Requires Windows")
def test_main_with_automate(mocker):
mocker.patch("win32com.server.localserver.serve")
sys.argv = ["pyi25.py", "/Automate"]
main()
win32com.server.localserver.serve.assert_called_once_with([PyI25._reg_clsid_])
if win32com:
mocker.patch("win32com.server.localserver.serve")
sys.argv = ["pyi25.py", "/Automate"]
main()
win32com.server.localserver.serve.assert_called_once_with([PyI25._reg_clsid_])

0 comments on commit ecb091e

Please sign in to comment.