|
| 1 | +# Knowledge Transfer Document - dyt221 |
| 2 | + |
| 3 | +This semester, I updated the README several times with instructions that |
| 4 | +hopefully will help future developers get started more quickly. I also improved |
| 5 | +the `create_dev_env` target in the makefile under the same goal. I cleaned up |
| 6 | +various Python files to improve overall compliance with PEP 8. I updated |
| 7 | +[APIServer/api.sh](APIServer/api.sh) script to use the recommended method of |
| 8 | +starting Flask. I modified the `/endpoints` endpoint on the API server to |
| 9 | +compute the Flask app's registered endpoints dynamically. The previous version |
| 10 | +used a hardcoded list. |
| 11 | + |
| 12 | +I worked primarily on testing. I fixed some tests that were not running |
| 13 | +inside the development Docker image. I changed the API server inside the |
| 14 | +development Docker image to start in development mode instead of production |
| 15 | +mode. I helped to retire `models/capital.py` in favor of the [models](models) |
| 16 | +module by fixing a test that would crash without that file. I figured out why |
| 17 | +[models/pytests.sh](models/pytests.sh) was running zero tests and fixed it. |
| 18 | + |
| 19 | +I started to write replacement tests for `EnvTestCase.test_from_json` inside |
| 20 | +[indra/tests/test_env.py](indra/tests/test_env.py). The test case is supposed |
| 21 | +to test whether various classes are being deserialized properly. As it was |
| 22 | +written, it actually was just putting hardcoded dictionaries through a |
| 23 | +deserialization function, converting the return value's type to a string, and |
| 24 | +comparing that string to a hardcoded one. I wrote one replacement test case, |
| 25 | +called `test_env_json_plot_title`. It sets a property, serializes the object, |
| 26 | +deserializes the object, and then checks that the value of that property |
| 27 | +survived. More tests should be written for other properties. Eventually, the |
| 28 | +entirety of [APIServer/test/test_env_json](APIServer/test/test_env_json) should |
| 29 | +no longer be needed. |
| 30 | + |
| 31 | +One more thing: look at `Agent.from_json` in [indra/agent.py](indra/agent.py). |
| 32 | +I suspect that when `Env` in [indra/env.py](indra/env.py) is initialized with a |
| 33 | +`serial_obj`, this function is getting called redundantly. It is called in |
| 34 | +`Agent`'s constructor, which is called via `super()` in subclasses, but the |
| 35 | +`from_json` methods of subclasses also seem to be calling `Agent.from_json` via |
| 36 | +`super()`. I did not have the chance to investigate or verify this, but I |
| 37 | +noticed this possible redundancy while reading the code. |
0 commit comments