Skip to content

Pre-commit applied to unit test files. #953

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

Merged
merged 20 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
files: ^pyaedt/
files: |
(?x)(
^pyaedt/|
_unittest/
)
exclude: |
(?x)(
^pyaedt/rpc/|
^pyaedt/third_party/|
pyaedt/conftest.py
pyaedt/conftest.py|
_unittest/example_models/
)
repos:
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.1.0
hooks:
- id: black
args:
- --line-length=120
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
rev: v3.0.1
hooks:
- id: reorder-python-imports
args:
Expand Down
11 changes: 7 additions & 4 deletions _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
}

"""
import tempfile
import gc
import json
import os
import shutil
import json
import gc
import sys
from pyaedt.generic.general_methods import is_ironpython, inside_desktop, generate_unique_name
import tempfile

from pyaedt import settings
from pyaedt.generic.general_methods import generate_unique_name
from pyaedt.generic.general_methods import inside_desktop
from pyaedt.generic.general_methods import is_ironpython

log_path = os.path.join(tempfile.gettempdir(), "test.log")
if os.path.exists(os.path.join(tempfile.gettempdir(), "test.log")):
Expand Down
11 changes: 10 additions & 1 deletion _unittest/launch_desktop_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Import required modules
from pyaedt import Hfss, Maxwell2d, Maxwell3d, Q2d, Q3d, TwinBuilder, Hfss3dLayout, Icepak, Circuit, Mechanical
from pyaedt import Circuit
from pyaedt import Hfss
from pyaedt import Hfss3dLayout
from pyaedt import Icepak
from pyaedt import Maxwell2d
from pyaedt import Maxwell3d
from pyaedt import Mechanical
from pyaedt import Q2d
from pyaedt import Q3d
from pyaedt import TwinBuilder


def run_desktop_tests():
Expand Down
7 changes: 3 additions & 4 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import os
import math
import os
import time

# Setup paths for module imports

# Import required modules
from pyaedt import Edb
from pyaedt.edb_core.components import resistor_value_parser

# Setup paths for module imports
# Import required modules

test_project_name = "Galileo_edb"
bom_example = "bom_example.csv"
Expand Down
1 change: 1 addition & 0 deletions _unittest/test_00_GeometryOperators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import math

import clr

from pyaedt.modeler.GeometryOperators import GeometryOperators as go

clr.AddReference("System.Collections")
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_00_downloads.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Import required modules
import tempfile
import os
import tempfile

from pyaedt.examples import downloads
from _unittest.conftest import BasisTest
from pyaedt.examples import downloads


class TestClass(BasisTest, object):
Expand Down
10 changes: 5 additions & 5 deletions _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# standard imports
import os

# Import required modules
from pyaedt import Desktop, get_pyaedt_app

# Setup paths for module imports
from _unittest.conftest import desktop_version, local_path, BasisTest
from _unittest.conftest import BasisTest
from _unittest.conftest import desktop_version
from _unittest.conftest import local_path
from pyaedt import Desktop
from pyaedt import get_pyaedt_app

try:
import pytest # noqa: F401
Expand Down
6 changes: 4 additions & 2 deletions _unittest/test_02_2D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import math
import os

from pyaedt.generic.general_methods import isclose, is_ironpython
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from pyaedt.generic.general_methods import is_ironpython
from pyaedt.generic.general_methods import isclose
from pyaedt.maxwell import Maxwell2d

# Setup paths for module imports
from _unittest.conftest import BasisTest, config

try:
import pytest # noqa: F401
Expand Down
5 changes: 3 additions & 2 deletions _unittest/test_02_3D_modeler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Setup paths for module imports
from _unittest.conftest import BasisTest, pyaedt_unittest_check_desktop_error
from pyaedt.modeler.Modeler import FaceCoordinateSystem
from _unittest.conftest import BasisTest
from _unittest.conftest import pyaedt_unittest_check_desktop_error
from pyaedt.application.Design import DesignCache
from pyaedt.modeler.Modeler import FaceCoordinateSystem

try:
import pytest # noqa: F401
Expand Down
13 changes: 7 additions & 6 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# standard imports
import os

# Import required modules
from pyaedt import Icepak, Maxwell3d
from pyaedt.modules.Material import MatProperties, SurfMatProperties

# Setup paths for module imports
from _unittest.conftest import desktop_version, local_path, BasisTest
from _unittest.conftest import BasisTest
from _unittest.conftest import desktop_version
from _unittest.conftest import local_path
from pyaedt import Icepak
from pyaedt import Maxwell3d
from pyaedt.modules.Material import MatProperties
from pyaedt.modules.Material import SurfMatProperties

try:
import pytest # noqa: F401
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_05_Mesh.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import desktop_version
from pyaedt import Maxwell3d

from _unittest.conftest import desktop_version, BasisTest

try:
import pytest # noqa: F401
except ImportError:
Expand Down
5 changes: 2 additions & 3 deletions _unittest/test_06_MessageManager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Setup paths for module imports
import logging

from _unittest.conftest import BasisTest
from _unittest.conftest import config
from pyaedt.application.MessageManager import AEDTMessageManager

# Import required modules
from _unittest.conftest import config, BasisTest

try:
import pytest
except ImportError:
Expand Down
9 changes: 5 additions & 4 deletions _unittest/test_07_Object3D.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# standard imports
import math

# Import required modules
from pyaedt.generic.general_methods import isclose, time_fn
from pyaedt.modeler.Object3d import FacePrimitive, _to_boolean, _uname

from _unittest.conftest import BasisTest
from pyaedt.generic.general_methods import isclose
from pyaedt.generic.general_methods import time_fn
from pyaedt.modeler.Object3d import _to_boolean
from pyaedt.modeler.Object3d import _uname
from pyaedt.modeler.Object3d import FacePrimitive


class TestClass(BasisTest, object):
Expand Down
5 changes: 3 additions & 2 deletions _unittest/test_09_Primitives2D.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/ekm/software/anaconda3/bin/python
# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import pyaedt_unittest_check_desktop_error
from pyaedt import Maxwell2d
from pyaedt.modeler.Primitives import Polyline
from pyaedt.application.Design import DesignCache
from pyaedt.modeler.Primitives import Polyline

# Setup paths for module imports
from _unittest.conftest import BasisTest, pyaedt_unittest_check_desktop_error

try:
import pytest # noqa: F401
Expand Down
6 changes: 3 additions & 3 deletions _unittest/test_09_VariableManager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Setup paths for module imports
from __future__ import division
from __future__ import division # noreorder
import math

from pyaedt.application.Variables import Variable
from _unittest.conftest import BasisTest
from pyaedt.application.Variables import decompose_variable_value
from pyaedt.application.Variables import Variable
from pyaedt.generic.general_methods import isclose

# Import required modules
from _unittest.conftest import BasisTest

try:
import pytest # noqa: F401
Expand Down
3 changes: 1 addition & 2 deletions _unittest/test_11_Setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# standard imports

# Setup paths for module imports
from _unittest.conftest import BasisTest
from pyaedt import Circuit

# Import required modules
from pyaedt import Circuit

test_project_name = "coax_setup"

Expand Down
6 changes: 2 additions & 4 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# standard imports
import os

# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from pyaedt import Hfss
from pyaedt.generic.general_methods import is_ironpython

# Setup paths for module imports
from _unittest.conftest import config, BasisTest

try:
import pytest
except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions _unittest/test_13_LoadAEDTFile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Setup paths for module imports
from _unittest.conftest import local_path, BasisTest

# Import required modules
from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file
import base64
import filecmp
import os
import sys

from _unittest.conftest import BasisTest
from _unittest.conftest import local_path
from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file


def _write_jpg(design_info, scratch):
"""writes the jpg Image64 property of the design info
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_14_AedtLogger.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Setup paths for module imports
import tempfile
import os
import io
import logging
import os
import shutil
import sys
import tempfile

try:
import pytest
Expand Down
5 changes: 3 additions & 2 deletions _unittest/test_15_ibs_reader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os

from pyaedt.generic import ibis_reader
from _unittest.conftest import BasisTest
from _unittest.conftest import local_path
from pyaedt import Circuit
from _unittest.conftest import local_path, BasisTest
from pyaedt.generic import ibis_reader


class TestClass(BasisTest, object):
Expand Down
8 changes: 3 additions & 5 deletions _unittest/test_17_SBR.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os

# Import required modules

from _unittest.conftest import BasisTest
from _unittest.conftest import desktop_version
from _unittest.conftest import local_path
from pyaedt import Hfss

# Setup paths for module imports
from _unittest.conftest import local_path, BasisTest, desktop_version

try:
import pytest # noqa: F401
except ImportError:
Expand Down
10 changes: 5 additions & 5 deletions _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import time

# Import required modules
from pyaedt import Circuit
from pyaedt.generic.TouchstoneParser import read_touchstone
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from _unittest.conftest import local_path
from pyaedt import Circuit # Setup paths for module imports
from pyaedt.generic.TouchstoneParser import read_touchstone # Setup paths for module imports

# Setup paths for module imports
from _unittest.conftest import local_path, config, BasisTest

try:
import pytest # noqa: F401
Expand Down
12 changes: 10 additions & 2 deletions _unittest/test_22_Circuit_DynamicLink.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# standard imports
import os
from _unittest.conftest import local_path, config, desktop_version, BasisTest

from pyaedt import Circuit, Q2d, Q3d, Hfss, settings
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from _unittest.conftest import desktop_version
from _unittest.conftest import local_path
from pyaedt import Circuit
from pyaedt import Hfss
from pyaedt import Q2d
from pyaedt import Q3d
from pyaedt import settings


try:
import pytest
Expand Down
7 changes: 4 additions & 3 deletions _unittest/test_26_emit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import config
from pyaedt import Emit
from pyaedt.modeler.PrimitivesEmit import EmitComponent, EmitComponents

from _unittest.conftest import config, BasisTest
from pyaedt.modeler.PrimitivesEmit import EmitComponent
from pyaedt.modeler.PrimitivesEmit import EmitComponents

try:
import pytest
Expand Down
9 changes: 4 additions & 5 deletions _unittest/test_27_Maxwell2D.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/ekm/software/anaconda3/bin/python

# Standard imports
import filecmp
import os

# Import required modules
from _unittest.conftest import BasisTest
from _unittest.conftest import local_path
from _unittest.conftest import pyaedt_unittest_check_desktop_error
from pyaedt import Maxwell2d
from pyaedt.generic.constants import SOLUTIONS
from pyaedt.application.Design import DesignCache

from _unittest.conftest import BasisTest, local_path, pyaedt_unittest_check_desktop_error
from pyaedt.generic.constants import SOLUTIONS

try:
import pytest # noqa: F401
Expand Down
Loading