Skip to content

Commit

Permalink
Package (#69)
Browse files Browse the repository at this point in the history
* move tests
* add description
* add license
* add pyproject
* remove requirements.txt and replace by pyproject.toml
* add CLI command
* update pipe
  • Loading branch information
beliaev-maksim authored Nov 15, 2021
1 parent a17c5f1 commit 3904d6d
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
python -m pip install .[test]
- name: Unittests
run: |
pytest unittests -v --disable-pytest-warnings
pytest tests/unittests -v
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 ANSYS, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Current framework has the following features:
## Installation
To install the package use:
```bash
pip install
pip install .
```

## Usage
Expand Down
8 changes: 8 additions & 0 deletions aedttest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Ansys Electronics Desktop Testing Framework.
Current module allows to setup and run automated tests and validate results across multiple versions of
Ansys Electronics Desktop products, eg HFSS, Maxwell, Icepak, Q3D, etc
"""

__version__ = "0.0.1"
__authors__ = "Maksim Beliaev, Bo Yang"
50 changes: 28 additions & 22 deletions aedttest/aedt_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

from pyaedt import __file__ as _py_aedt_path # noreorder

__authors__ = "Maksim Beliaev, Bo Yang"

MODULE_DIR = Path(__file__).resolve().parent
CWD_DIR = Path.cwd()
Expand All @@ -50,6 +49,33 @@
PROJECT_PAGE_TEMPLATE = get_template("static/project-report.html")


def main() -> None:
"""
Main function that is executed by 'flit' CLI script and by executing this python file
Returns:
None
"""
try:
cli_args = parse_arguments()
except ValueError as exc:
logger.error(str(exc))
raise SystemExit(1)
aedt_tester = ElectronicsDesktopTester(
version=cli_args.aedt_version,
max_cores=cli_args.max_cores,
max_tasks=cli_args.max_tasks,
config_file=cli_args.config_file,
out_dir=cli_args.out_dir,
save_projects=cli_args.save_sim_data,
only_reference=cli_args.only_reference,
reference_file=cli_args.reference_file,
)
try:
aedt_tester.run()
except Exception as exc:
logger.exception(str(exc))


class ElectronicsDesktopTester:
def __init__(
self,
Expand Down Expand Up @@ -668,24 +694,4 @@ def parse_arguments() -> argparse.Namespace:


if __name__ == "__main__":
try:
args_cli = parse_arguments()
except ValueError as exc:
logger.error(str(exc))
raise SystemExit(1)

aedt_tester = ElectronicsDesktopTester(
version=args_cli.aedt_version,
max_cores=args_cli.max_cores,
max_tasks=args_cli.max_tasks,
config_file=args_cli.config_file,
out_dir=args_cli.out_dir,
save_projects=args_cli.save_sim_data,
only_reference=args_cli.only_reference,
reference_file=args_cli.reference_file,
)

try:
aedt_tester.run()
except Exception as exc:
logger.exception(str(exc))
main()
4 changes: 2 additions & 2 deletions docs/CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Configure your enviornment
Install all dependencies
```bash
pip install -r requirements-dev.txt
pip install .[test]
```

Install pre-commit
Expand All @@ -20,5 +20,5 @@ pre-commit install

## Validate types
```bash
mypy --config-file=./mypy.ini unittests\test_aedttest.py
mypy --config-file=./mypy.ini tests
```
44 changes: 44 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# description if packaging system requirements
[build-system]
requires = [
"flit_core >=3.2,<4",
]
build-backend = "flit_core.buildapi"

# desciption of current module
[project]
name = "aedttest"
authors = [
{name = "Maksim Beliaev", email = "[email protected]"},
{name = "Bo Yang", email = "[email protected]"},
]
readme = "README.md"
requires-python = ">=3.7"
classifiers = ["License :: OSI Approved :: MIT License"]
dynamic = ["version", "description"]

dependencies = [
"pyaedt==0.4.7",
"Django==3.2.8",
]

# development dependencies
[project.optional-dependencies]
test = [
"black==21.9b0",
"pre-commit==2.15.0",
"mypy==0.910",
"pytest==6.2.5",
"pytest-cov==3.0.0",
]

deploy = [
"flit==3.4.0",
]

[project.urls]
Home = "https://github.com/ansys/aedt-testing"

# CLI script command
[project.scripts]
aedt_test_runner = "aedttest.aedt_test_runner:main"
6 changes: 0 additions & 6 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

File renamed without changes.
Empty file added tests/unittests/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.

0 comments on commit 3904d6d

Please sign in to comment.