Add pytest to Resource Mapping Tool requirements.txt (#6259)

* Add pytest to Resource Mapping Tool requirements.txt

Signed-off-by: allisaurus <34254888+allisaurus@users.noreply.github.com>
This commit is contained in:
allisaurus
2021-12-21 11:11:45 -08:00
committed by GitHub
parent 37bb001040
commit 704aef8cad
2 changed files with 37 additions and 14 deletions
@@ -1,35 +1,40 @@
# Welcome to the AWS Core Resource Mapping Tool project!
## Setup aws config and credential
Resource mapping tool is using boto3 to interact with aws services:
## Setup aws config and credentials
The Resource Mapping Tool uses boto3 to interact with aws services:
* Read boto3
[Configuration](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html) to setup default aws region.
* Read boto3
[Credentials](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html) to setup default profile or credential keys.
Or follow **AWS CLI** configuration which can be reused by boto3 lib:
Or follow **AWS CLI** configuration directions which can be reused by the boto3 lib:
* Follow
[Quick configuration with aws configure](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config)
## Python Environment Setup Options
### 1. Engine python environment (Including Editor)
1. In order to use engine python environment, it requires to link Qt binaries for this tool.
### 1. Use Engine python environment (Including Editor)
1. In order to use the Open 3D Engine's python environment, this tool requires linking the Qt binaries.
Follow cmake instructions to configure your project, for example:
```
$ cmake -B <BUILD_FOLDER> -S . -G "Visual Studio 16 2019" -DLY_PROJECTS=<PROJECT_NAME>
```
2. At this point, double check engine python environment gets setup under *<ENGINE_ROOT_PATH>/python/runtime* directory
2. At this point, double check that the Open 3D Engine's python environment gets set up under *<ENGINE_ROOT_PATH>/python/runtime* directory
3. Build project with **AWSCore.Editor** (or **AWSCore.ResourceMappintTool**, or **Editor**) target to generate required Qt binaries.
3. Build the project with the **AWSCore.Editor** (or **AWSCore.ResourceMappingTool**, or **Editor**) target to generate the required Qt binaries.
* Windows
```
$ cmake --build <BUILD_FOLDER> --target AWSCore.Editor --config <CONFIG> /m
```
* Linux
```
$ cmake --build <BUILD_FOLDER> --target AWSCore.Editor --config <CONFIG> -j <NUM_JOBS>
```
4. At this point, double check Qt binaries gets generated under *<BUILD_FOLDER>/bin/<CONFIG_FOLDER>/AWSCoreEditorQtBin* directory
4. At this point, double check the Qt binaries have been generated under *<BUILD_FOLDER>/bin/<CONFIG_FOLDER>/AWSCoreEditorQtBin* directory
5. Launch resource mapping tool under engine root folder:
5. Launch the Resource Mapping Tool from the engine root folder:
* Windows
* release mode
```
@@ -49,10 +54,9 @@ Follow cmake instructions to configure your project, for example:
$ python/python.sh Gems/AWSCore/Code/Tools/ResourceMappingTool/resource_mapping_tool.py --binaries_path <PATH_TO_BUILD_FOLDER>/bin/debug/AWSCoreEditorQtBin
```
* Note - Editor is integrated with the same engine python environment to launch Resource Mapping Tool. If it is failed to launch the tool
in Editor, please follow above steps to make sure expected scripts/binaries are present.
* Note - the engine Editor is integrated with the same python environment used to launch the Resource Mapping Tool. If the tool fails to launch from the Editor, please double check that you have completed all of the above steps and that the expected scripts and binaries are present in the expected directories.
### 2. Python virtual environment
### 2. Use a separate python virtual environment
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the `.env`
directory. To create the virtualenv it assumes that there is a `python3`
@@ -105,7 +109,23 @@ you can create the virtualenv manually.
* `--config-path` **[Optional]** Path to resource mapping config directory,
if not provided tool will use current directory.
* `--debug` **[Optional]** Execute on debug mode to enable DEBUG logging level.
* `--log-path` **[Optional]** Path to resource mapping tool logging directory,
* `--log-path` **[Optional]** Path to Resource Mapping Tool logging directory,
if not provided tool will store logging under tool source code directory.
* `--profile` **[Optional]** Named AWS profile to use for querying AWS resources,
if not provided tool will use `default` aws profile.
if not provided tool will use `default` aws profile.
## Running tests
How to run the unit tests for the project:
1. If not already activated, activate the project's python environment as explained above.
2. Use `pytest` to run one or more tests (command paths formatted as if run from this directory):
* Run all the tests
```
python -m pytest -vv .
```
* Run a specific test file or directory:
```
python -m pytest tests\unit\model\test_basic_resource_attributes.py
```
@@ -1,2 +1,5 @@
PySide2>=5.15.2
boto3>=1.17.30
pytest>=5.3.2