@@ -76,9 +76,10 @@ Finally, click ``Ok`` again to get back to the main screen of PyCharm.
76
76
Install requirements
77
77
~~~~~~~~~~~~~~~~~~~~
78
78
79
- Inside the PyCharm editor window we should now get a bar at the top of the
80
- window telling us of missing package requirements, click the
81
- ``Install requirements `` option to install the dependencies for faucet.
79
+ Inside the PyCharm editor window if we open one of the code files for faucet
80
+ (e.g. faucet/faucet.py) we should now get a bar at the top of the window
81
+ telling us of missing package requirements, click the ``Install requirements ``
82
+ option to install the dependencies for faucet.
82
83
83
84
Create log and configuration directories
84
85
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -99,26 +100,29 @@ Copy the sample gauge configuration file from
99
100
``/Dev/faucet/etc/faucet/gauge.yaml `` to ``/Dev/faucet/venv/etc/faucet/ `` and
100
101
edit this configuration file as necessary.
101
102
102
- Configure PyCharm to run faucet
103
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103
+ Configure PyCharm to run faucet and gauge
104
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
105
105
106
Now we need to configure PyCharm to run faucet, gauge and the unit tests.
106
107
107
108
First, click the ``Run -> Run.. `` menu, then select the
108
109
``Edit Configurations... `` option to get to the build settings dialog.
109
110
110
- We will edit the default ``faucet `` run configuration that has been created
111
- for us. First change the ``Script path `` to point to ryu-manager inside the
112
- virtualenv, for me this was ``../venv/bin/ryu-manager ``. Then set the
113
- ``Parameters `` to ``faucet.faucet ``. Make sure the working directory is
114
- set to ``/Dev/faucet/faucet/ ``.
111
+ We will now add run configuration for starting ``faucet `` and ``gauge ``.
112
+ Click the ``+ `` button in the top left hand corner of the window. First, change
113
+ the name from ``Unnamed `` to ``faucet ``. Change the ``Script path `` to point to
114
+ ryu-manager inside the virtualenv, for me this was ``../venv/bin/ryu-manager ``.
115
+ Then set the ``Parameters `` to ``faucet.faucet ``. Make sure the working
116
+ directory is set to ``/Dev/faucet/faucet/ ``.
115
117
116
- We will also add a ``gauge `` run configuration for starting gauge.
117
- First change the ``Script path `` to point to ryu-manager inside the
118
- virtualenv, for me this was ``../venv/bin/ryu-manager ``. Then set the
119
- ``Parameters `` to ``faucet.gauge ``. Make sure the working directory is
118
+ We will use the same steps as above to add a run configuration for ``gauge ``.
119
+ Changing the ``Script path `` to ``../venv/bin/ryu-manager `` and setting the
120
+ ``Parameters `` this time to ``faucet.gauge ``. Make sure the working directory is
120
121
set to ``/Dev/faucet/faucet/ ``.
121
122
123
+ Configure PyCharm to run unit tests
124
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125
+
122
126
For running tests we need a few additional dependencies installed, I
123
127
couldn't work out how to do this through PyCharm so run this command from a
124
128
terminal window to install the correct dependencies inside the virtualenv:
@@ -127,11 +131,16 @@ terminal window to install the correct dependencies inside the virtualenv:
127
131
128
132
/Dev/faucet/venv/bin/pip3 install -r /Dev/faucet/test-requirements.txt
129
133
130
- Click the green plus icon to add a new build configuration, select
131
- ``Python tests -> Unittests ``. You can provide a ``Name `` of
132
- ``Faucet Unit Tests `` for the run configuration. For ``Target `` select
133
- ``Script path `` and enter the path ``/Dev/faucet/tests/unit ``. For ``Pattern ``
134
- enter ``test_*.py ``.
134
+ To add the test run configuration we will again click the ``+ `` button in the
135
+ top left hand corner, select ``Python tests -> Unittests ``.
136
+ You can provide a ``Name `` of ``Faucet Unit Tests `` for the run configuration.
137
+ For ``Target `` select ``Script path `` and enter the path
138
+ ``/Dev/faucet/tests/unit/faucet ``. For ``Pattern `` enter ``test_*.py ``.
139
+
140
+ We will also add test run configuration for gauge using the same steps as above.
141
+ Use ``Gauge Unit Tests `` as the ``Name `` and for ``Target `` select
142
+ ``Script path `` and enter the path ``/Dev/faucet/tests/unit/gauge ``.
143
+ For ``Pattern `` enter ``test_*.py ``.
135
144
136
145
You can click ``Apply `` and ``Close `` now that we've added all our new
137
146
run configuration.
0 commit comments