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

Format import blocks in test/*.py. #792

Merged
merged 35 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0865720
Format the import block in `test/test_basic.py`.
junkmd Feb 2, 2025
482402a
Format the import block in `test/test_imfattributes.py`.
junkmd Feb 2, 2025
2f3e747
Format the import block in `test/test_monikers.py`.
junkmd Feb 2, 2025
1ae3fbd
Format the import block in `test/test_storage.py`.
junkmd Feb 2, 2025
993dafb
Format the import block in `test/test_stream.py`.
junkmd Feb 2, 2025
a8b4413
Format the import block in `test/test_urlhistory.py`.
junkmd Feb 2, 2025
8e28a7e
Format the import block in `test/TestDispServer.py`.
junkmd Feb 2, 2025
7e6ba4a
Add `import comtypes.connectionpoints` to `test/TestDispServer.py`.
junkmd Feb 2, 2025
2915ff6
Format the import block in `test/__init__.py`.
junkmd Feb 2, 2025
a566e67
Format the import block in `test/runtests.py`.
junkmd Feb 2, 2025
ef3c92c
Format the import block in `test/setup.py`.
junkmd Feb 2, 2025
fca4fdd
Format the import block in `test/test_agilent.py`.
junkmd Feb 2, 2025
a87d342
Format the import block in `test/test_clear_cache.py`.
junkmd Feb 2, 2025
94b3c1c
Format the import block in `test/test_client_dynamic.py`.
junkmd Feb 2, 2025
0401fdf
Format the import block in `test/test_client_regenerate_modules.py`.
junkmd Feb 2, 2025
6086e94
Format the import block in `test/test_client.py`.
junkmd Feb 2, 2025
490c37d
Format the import block in `test/test_collections.py`.
junkmd Feb 2, 2025
3ca0ef4
Format the import block in `test/test_dispifc_records.py`.
junkmd Feb 2, 2025
ec26f34
Format the import block in `test/test_dispifc_safearrays.py`.
junkmd Feb 2, 2025
7e0ad4c
Format the import block in `test/test_dyndispatch.py`.
junkmd Feb 2, 2025
3d4d0be
Format the import block in `test/test_findgendir.py`.
junkmd Feb 2, 2025
eb561ee
Format the import block in `test/test_GUID.py`.
junkmd Feb 2, 2025
783b611
Format the import block in `test/test_ienum.py`.
junkmd Feb 2, 2025
d2cb62b
Format the import block in `test/test_midl_safearray_create.py`.
junkmd Feb 2, 2025
af556fe
Format the import block in `test/test_msscript.py`.
junkmd Feb 2, 2025
8c809c5
Format the import block in `test/test_npsupport.py`.
junkmd Feb 2, 2025
e128ff2
Format the import block in `test/test_persist.py`.
junkmd Feb 2, 2025
3ae9bbf
Format the import block in `test/test_QueryService.py`.
junkmd Feb 2, 2025
54db768
Format the import block in `test/test_recordinfo.py`.
junkmd Feb 2, 2025
fd566e3
Format the import block in `test/test_sapi.py`.
junkmd Feb 2, 2025
7bf0b07
Format the import block in `test/test_shelllink.py`.
junkmd Feb 2, 2025
57ce539
Format the import block in `test/test_subinterface.py`.
junkmd Feb 2, 2025
ea5b685
Format the import block in `test/test_typeannotator.py`.
junkmd Feb 2, 2025
fbafaa5
Format the import block in `test/test_variant.py`.
junkmd Feb 2, 2025
b16a183
Format the import block in `test/test_word.py`.
junkmd Feb 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions comtypes/test/TestDispServer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys, os
import logging
import os
import sys

logging.basicConfig()
##logging.basicConfig(level=logging.DEBUG)
Expand All @@ -9,8 +10,9 @@
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), r"..\..")))

import comtypes
from comtypes.hresult import S_OK
import comtypes.connectionpoints
import comtypes.server.connectionpoints
from comtypes.hresult import S_OK

################################################################

Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def usage():

def test_with_refcounts(runner, verbosity, testcase):
"""Run testcase several times, tracking reference counts."""
import gc
import ctypes
import gc

ptc = ctypes._pointer_type_cache.copy()
cfc = ctypes._c_functype_cache.copy()
Expand Down
1 change: 1 addition & 0 deletions comtypes/test/runtests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

import comtypes.test


Expand Down
3 changes: 2 additions & 1 deletion comtypes/test/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# all the unittests can be converted to exe-files.
from distutils.core import setup
import glob
from distutils.core import setup

import py2exe

setup(name="test_*", console=glob.glob("test_*.py"))
1 change: 1 addition & 0 deletions comtypes/test/test_GUID.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest

from comtypes import GUID


Expand Down
1 change: 1 addition & 0 deletions comtypes/test/test_QueryService.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
from ctypes import POINTER

import comtypes
from comtypes.client import CreateObject, GetModule

Expand Down
7 changes: 4 additions & 3 deletions comtypes/test/test_agilent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# connected, the driver is used in simulation mode.

import unittest
from comtypes.test import ResourceDenied
from comtypes.client import CreateObject
from ctypes import POINTER, c_double

from comtypes import GUID
from comtypes.client import CreateObject
from comtypes.safearray import _midlSAFEARRAY
from ctypes import c_double, POINTER
from comtypes.test import ResourceDenied

try:
GUID.from_progid("Agilent546XX.Agilent546XX")
Expand Down
7 changes: 4 additions & 3 deletions comtypes/test/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
##import ut
import unittest as ut
from ctypes import POINTER, byref, HRESULT
from comtypes import IUnknown, STDMETHOD, GUID
from comtypes.typeinfo import _CreateTypeLib2, ICreateTypeLib2
from ctypes import HRESULT, POINTER, byref

from comtypes import GUID, STDMETHOD, IUnknown
from comtypes.typeinfo import ICreateTypeLib2, _CreateTypeLib2

# XXX leaks references!

Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/test_clear_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import contextlib
import runpy
from unittest.mock import patch, call
from unittest import TestCase
from unittest.mock import call, patch

from comtypes.client import _find_gen_dir

Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import contextlib
from ctypes import POINTER, byref
import os
import sys
import unittest as ut
from ctypes import POINTER, byref

import comtypes.client
from comtypes import COSERVERINFO, CLSCTX_INPROC_SERVER
from comtypes import CLSCTX_INPROC_SERVER, COSERVERINFO

# create the typelib wrapper and import it
comtypes.client.GetModule("scrrun.dll")
Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_client_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import unittest as ut
from unittest import mock

from comtypes import automation, COMError, IUnknown
from comtypes.client import CreateObject, dynamic, GetModule, lazybind
from comtypes import COMError, IUnknown, automation
from comtypes.client import CreateObject, GetModule, dynamic, lazybind


class Test_Dispatch_Function(ut.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_client_regenerate_modules.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import contextlib
import importlib
from pathlib import Path
import shutil
import sys
import tempfile
import types
from typing import Iterator
import unittest as ut
from pathlib import Path
from typing import Iterator
from unittest import mock

import comtypes
Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/test_collections.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from comtypes.client import CreateObject
from ctypes import ArgumentError

from comtypes.client import CreateObject
from comtypes.test.find_memleak import find_memleak


Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/test_dispifc_records.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# coding: utf-8

import unittest
from ctypes import byref, pointer

from comtypes import CLSCTX_LOCAL_SERVER
from comtypes.client import CreateObject, GetModule
from ctypes import byref, pointer

ComtypesCppTestSrvLib_GUID = "{07D2AEE5-1DF8-4D2C-953A-554ADFD25F99}"

Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/test_dispifc_safearrays.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

from ctypes import byref, c_double, pointer
import unittest
from ctypes import byref, c_double, pointer

import comtypes
import comtypes.safearray
Expand Down
1 change: 1 addition & 0 deletions comtypes/test/test_dyndispatch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest

from comtypes.automation import IDispatch
from comtypes.client import CreateObject, GetModule
from comtypes.client.lazybind import Dispatch
Expand Down
3 changes: 1 addition & 2 deletions comtypes/test/test_findgendir.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import sys
import tempfile
import types
from typing import Iterator
import unittest
from typing import Iterator
from unittest import mock

import comtypes
import comtypes.client
import comtypes.gen


IMGBASE = os.path.splitext(os.path.basename(sys.executable))[0]


Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_ienum.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import contextlib
import unittest as ut

from ctypes import POINTER
from comtypes import GUID

import comtypes.client
from comtypes import GUID


class Test_IEnum(ut.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_imfattributes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import contextlib
import unittest as ut

from ctypes import HRESULT, POINTER, WinDLL, c_uint32, pointer
from comtypes import GUID

import comtypes.client
from comtypes import GUID


class Test_IMFAttributes(ut.TestCase):
Expand Down
10 changes: 6 additions & 4 deletions comtypes/test/test_midl_safearray_create.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# coding: utf-8

from ctypes import c_int, pointer, HRESULT, POINTER
import unittest
from ctypes import HRESULT, POINTER, c_int, pointer

import comtypes
import comtypes.safearray
import comtypes.typeinfo
from comtypes import CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER
from comtypes.client import CreateObject, GetModule
import comtypes.typeinfo

GetModule("UIAutomationCore.dll")
from comtypes.gen.UIAutomationClient import CUIAutomation, IUIAutomation
Expand All @@ -16,8 +16,10 @@

try:
GetModule((ComtypesCppTestSrvLib_GUID, 1, 0, 0))
from comtypes.gen.ComtypesCppTestSrvLib import StructRecordParamTest
from comtypes.gen.ComtypesCppTestSrvLib import IDispSafearrayParamTest
from comtypes.gen.ComtypesCppTestSrvLib import (
IDispSafearrayParamTest,
StructRecordParamTest,
)

IMPORT_FAILED = False
except (ImportError, OSError):
Expand Down
11 changes: 5 additions & 6 deletions comtypes/test/test_monikers.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
from _ctypes import COMError
from ctypes import HRESULT, OleDLL, byref, POINTER, c_wchar_p
from ctypes.wintypes import DWORD
import contextlib
import unittest
from _ctypes import COMError
from ctypes import HRESULT, POINTER, OleDLL, byref, c_wchar_p
from ctypes.wintypes import DWORD

from comtypes.client import GetModule, CreateObject
from comtypes import hresult, GUID
from comtypes import GUID, hresult
from comtypes.client import CreateObject, GetModule

with contextlib.redirect_stdout(None): # supress warnings
GetModule("msvidctl.dll")
from comtypes.gen import MSVidCtlLib as msvidctl
from comtypes.gen.MSVidCtlLib import IBindCtx, IMoniker, IRunningObjectTable


MKSYS_ITEMMONIKER = 4
ROTFLAGS_ALLOWANYCLIENT = 1
LPOLESTR = LPCOLESTR = c_wchar_p
Expand Down
3 changes: 2 additions & 1 deletion comtypes/test/test_msscript.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
from ctypes import POINTER

from comtypes import GUID
from comtypes.automation import IDispatch
from comtypes.client import CreateObject
from comtypes import GUID

##from test import test_support
##from comtypes.unittests import support
Expand Down
8 changes: 4 additions & 4 deletions comtypes/test/test_npsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
import importlib
import inspect
import unittest
from ctypes import c_long, c_double, pointer, POINTER
from ctypes import POINTER, c_double, c_long, pointer
from decimal import Decimal

import comtypes._npsupport
from comtypes import IUnknown
from comtypes._safearray import SafeArrayGetVartype
from comtypes.automation import (
BSTR,
VARIANT,
VARIANT_BOOL,
VT_BSTR,
VT_DATE,
VT_I4,
_midlSAFEARRAY,
VARIANT,
VT_VARIANT,
VARIANT_BOOL,
_midlSAFEARRAY,
)
from comtypes.safearray import safearray_as_ndarray

Expand Down
6 changes: 2 additions & 4 deletions comtypes/test/test_persist.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from pathlib import Path
import tempfile
import unittest as ut
from pathlib import Path

from comtypes import CoCreateInstance, GUID, IPersist
from comtypes import persist

from comtypes import GUID, CoCreateInstance, IPersist, persist

CLSID_ShellLink = GUID("{00021401-0000-0000-C000-000000000046}")

Expand Down
2 changes: 1 addition & 1 deletion comtypes/test/test_recordinfo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# coding: utf-8

import unittest
from ctypes import byref, pointer, sizeof

from comtypes import typeinfo
from comtypes.client import GetModule
from ctypes import byref, pointer, sizeof

ComtypesCppTestSrvLib_GUID = "{07D2AEE5-1DF8-4D2C-953A-554ADFD25F99}"

Expand Down
5 changes: 4 additions & 1 deletion comtypes/test/test_sapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# ../gen/_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_0
# http://thread.gmane.org/gmane.comp.python.ctypes.user/1485

import os, unittest, tempfile
import os
import tempfile
import unittest

from comtypes.client import CreateObject


Expand Down
5 changes: 2 additions & 3 deletions comtypes/test/test_shelllink.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from pathlib import Path
import tempfile
import unittest as ut
from pathlib import Path

from comtypes import CoCreateInstance, GUID, shelllink
import comtypes.hresult
from comtypes import GUID, CoCreateInstance, shelllink
from comtypes.persist import IPersistFile


CLSID_ShellLink = GUID("{00021401-0000-0000-C000-000000000046}")


Expand Down
8 changes: 3 additions & 5 deletions comtypes/test/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import contextlib
import unittest
from _ctypes import COMError
from ctypes import HRESULT, OleDLL, byref, c_ubyte, POINTER
from ctypes import HRESULT, POINTER, OleDLL, byref, c_ubyte
from ctypes.wintypes import DWORD, PWCHAR
from pathlib import Path
import contextlib
import unittest

import comtypes
import comtypes.client


with contextlib.redirect_stdout(None): # supress warnings
mod = comtypes.client.GetModule("msvidctl.dll")

from comtypes.gen.MSVidCtlLib import IStorage


STATFLAG_DEFAULT = 0
STGC_DEFAULT = 0
STGM_CREATE = 0x00001000
Expand Down
1 change: 0 additions & 1 deletion comtypes/test/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
comtypes.client.GetModule("portabledeviceapi.dll")
from comtypes.gen.PortableDeviceApiLib import IStream


STGC_DEFAULT = 0
STREAM_SEEK_SET = 0
STREAM_SEEK_CUR = 1
Expand Down
6 changes: 4 additions & 2 deletions comtypes/test/test_subinterface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import unittest, sys
from comtypes import IUnknown, GUID
import sys
import unittest
from ctypes import *

from comtypes import GUID, IUnknown


def test_main():
from test import test_support
Expand Down
Loading