@@ -60,129 +60,4 @@ You must use your real name and email address.
60
60
61
61
To save you having to type the above for every commit, Git can add the ` Signed-off-by ` line. When committing, add the ` -s ` option to your ` git commit ` command.
62
62
63
- If you haven't signed each commit, then the pull request will fail to pass all checks.
64
-
65
- # Development Environment Set-Up Instructions
66
- =============================================
67
-
68
- This repository contains an Ansible collection, which is tested using ` ansible-test ` . This combination of development
69
- tooling requires you to clone the repository to a pretty specific path. As an example, clone the repository to:
70
-
71
- ```
72
- .../ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics
73
- ```
74
-
75
- ` ansible-test ` requires your project to exist in a FQCN-compatible folder structure following the Ansible Collections
76
- conventions. For details, see [ this issue] ( https://github.com/ansible/ansible/issues/60215 ) .
77
-
78
- ### Create a new virtual environment
79
-
80
- Create a virtual environment in the checked out repository. The dir ` venv3 ` is gitignored, and the rest of this
81
- documentation assumes you'll be using that as the name for your virtual environment:
82
-
83
- ``` bash
84
- # Create a new venv called venv3
85
- python3 -m venv venv3
86
-
87
- # Activate venv3
88
- source venv3/bin/activate
89
-
90
- # Install dev-requirements
91
- pip install -r dev-requirements.txt
92
- ```
93
-
94
- #### Running the unit tests
95
-
96
- You can use the ` ansible-test ` command to run all of the unit tests:
97
- ``` bash
98
- # Run unit tests
99
- ansible-test units --python=3.8
100
- ```
101
-
102
- #### Run Integration Tests
103
-
104
- You can also use the ` ansible-test ` command to run all of the integration tests:
105
-
106
- ``` bash
107
- # Run integration tests
108
- ansible-test integration --python=3.8
109
- ```
110
-
111
- ### PyCharm set-up instructions
112
-
113
- If you're planning on using a development environment such as PyCharm to develop ` ibm_zos_cics ` , you will need to
114
- load the bolded folder in the sample checkout path, in order that your development environment is able to resolve
115
- references to FQCN imports:
116
-
117
- <code >.../<b >ibm_zos_cics</b >/ansible_collections/ibm/ibm_zos_cics</code >
118
-
119
- #### Make your virtual environment the default Python interpreter for the project
120
-
121
- Add the virtual environment as an existing Python interpreter:
122
-
123
- - ` Preferences > Project: cics-ansible > Python Interpreter > Cog menu > Add.. > {project_root}/ansible_collections/ibm/ibm_zos_cics/env/bin/python `
124
-
125
- Set the virtual environment as the default Python interpreter:
126
-
127
- - ` Preferences > Project: cics-ansible > Python Interpreter > Top dropdown box > Select interpreter you just imported > Apply `
128
-
129
- #### Python 2 support
130
-
131
- The CMCI modules support running on Python 2.7. To ensure we maintain python 2.7 compatibility, you will also want to
132
- configure a Python 2.7 virtualenv:
133
-
134
- ``` bash
135
- # Ensure virtualenv is installed
136
- python2.7 -m pip install virtualenv
137
-
138
- # Create a new virtualenv called venv2
139
- python2.7 -m virtualenv venv2
140
-
141
- # Activate venv2
142
- source venv2/bin/activate
143
-
144
- # Install dev-requirements
145
- pip install -r dev-requirements.txt
146
- ```
147
-
148
- Note that a slightly different set of dev requirements is installed for python 2.7, as most of the static analysis tools in
149
- the automated build are run in python 3.8, so are not dev requirements for the python 2.7 environment.
150
-
151
- #### Running the build, tests and static analysis locally
152
-
153
- A bash script is provided to automate running the static analysis, and tests in both python 2.7 and python 3.8
154
- environments. You will need to have set up ` venv ` s as described above, with the dev-requirements pre-installed. You will
155
- then be able to run the build, passing the locations of the python 2.7 and python 3.8 ` venv ` s as environment variables:
156
-
157
- ``` bash
158
- CMCI_PYTHON_38=./venv3 CMCI_PYTHON_27=./venv2 ./build.sh
159
- ```
160
-
161
- If you are running on Windows, you will need to run the automated build in a docker container produced by building the ` Dockerfile ` in this repository
162
-
163
- #### Configure PyCharm to be able to run Ansible collection unit tests
164
-
165
- First, add the ` ansible_pytest_collections ` plugin to ` PYTHONPATH ` for your python interpreter. This will be in your
166
- venv if you installed the dependencies using the dev requirements file:
167
-
168
- - `Preferences > Project: cics-ansible > Python Interpreter > Cog menu > Show all >
169
- Select your interpreter > Show paths for the selected interpreter (at the bottom) > Plus >
170
- add the path to the 'ansible_test' 'pytest' plugin in your python environment`
171
-
172
- - For the sample path:
173
- ` .../ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/venv3/lib/python3.8/site-packages/ansible_test/_data/pytest/plugins `
174
-
175
- Next, you'll need to set some default environment variables for pytest launches, to enable the
176
- ` ansible_pytest_collections ` plugin, and successfully resolve the ` ibm_zos_cics ` collection locally.
177
-
178
- Go to ` Run Config Menu > Edit Configurations... > Templates > Python tests > pytest > Environment variables button `
179
-
180
- - Set ` PYTEST_PLUGINS ` to ` ansible_pytest_collections `
181
-
182
- - Set ` ANSIBLE_COLLECTIONS_PATHS ` to your project root, i.e. the directory that contains ` ansible_collections ` . For the
183
- example configuration, that's set to ` .../ibm_zos_cics ` .
184
-
185
- * (You may need to delete existing test configurations in ` Python Tests ` as they won't have been created with the new
186
- template)*
187
-
188
- You should be able to launch the unit tests in ` tests/unit/modules ` by clicking the play button.
63
+ If you haven't signed each commit, then the pull request will fail to pass all checks.
0 commit comments