Commit graph

2086 commits

Author SHA1 Message Date
Paul Gauthier
1b57a395d2 aider: Changed the way subprocess.run is mocked in test_check_for_ctags_success to return different results for each call.
# Context:
USER: in `test_check_for_ctags_success` we need to mock `subprocess`.run differently. it will be called twice and needs to return different results for each call.
ASSISTANT: To modify the `test_check_for_ctags_success` method in the `tests/test_repomap.py` file, we need to change the way `subprocess.run` is mocked. It will be called twice and needs to return different results for each call.

Here are the steps to make the changes:

1. Import `MagicMock` from `unittest.mock`.
2. Replace the `mock_run.return_value` with `mock_run.side_effect` which is a list of `CompletedProcess` objects. The first one simulates a successful call to `ctags --version` and the second one simulates a successful call to `ctags -R`.

Here is the *edit block* for the changes:

```python
tests/test_repomap.py
<<<<<<< ORIGINAL
from unittest.mock import patch
from subprocess import CompletedProcess

def test_check_for_ctags_success(self):
    with patch("subprocess.run") as mock_run:
        mock_run.return_value = CompletedProcess(
            args=["ctags", "--version"],
            returncode=0,
            stdout=(
                b'{"_type": "tag", "name": "status", "path": "aider/main.py", "pattern": "/^   '
                b' status = main()$/", "kind": "variable"}'
            ),
        )
        repo_map = RepoMap()
        result = repo_map.check_for_ctags()
        self.assertTrue(result)
=======
from unittest.mock import patch, MagicMock
from subprocess import CompletedProcess

def test_check_for_ctags_success(self):
    with patch("subprocess.run") as mock_run:
        mock_run.side_effect = [
            CompletedProcess(
                args=["ctags", "--version"],
                returncode=0,
                stdout=b"Universal Ctags 0.0.0(f25b4bb7)",
            ),
            CompletedProcess(
                args=["ctags", "-R"],
                returncode=0,
                stdout=b"",
            ),
        ]
        repo_map = RepoMap()
        result = repo_map.check_for_ctags()
        self.assertTrue(result)
>>>>>>> UPDATED
```

This change will make the `test_check_for_ctags_success` method simulate two calls to `subprocess.run` with different results.
2023-07-03 10:37:52 -07:00
Paul Gauthier
1f16b15f92 Added more clear error messages when universal-ctags is disabled per issue #31 2023-07-03 10:31:04 -07:00
Paul Gauthier
e98db7dfce possible fix for #38 2023-07-03 09:59:03 -07:00
Paul Gauthier
4ec3203b91 fix for issue #33 2023-07-02 17:53:40 -07:00
Paul Gauthier
bad642afa4 bugfix 2023-07-02 17:52:28 -07:00
Paul Gauthier
cbe59b85c2 refactor the jsonschema check into base 2023-07-02 17:44:26 -07:00
Paul Gauthier
ba2c5d05da new svg 2023-07-02 10:45:14 -07:00
Paul Gauthier
fc519ca6b8 copy 2023-07-02 10:39:50 -07:00
Paul Gauthier
4ea70bfdc0 new svg 2023-07-02 10:35:11 -07:00
Paul Gauthier
e2776fd8fe copy 2023-07-02 10:33:55 -07:00
Paul Gauthier
5e4ad5bf00 new svg 2023-07-02 10:28:39 -07:00
Paul Gauthier
8f4a823855 new svg 2023-07-02 10:26:18 -07:00
Paul Gauthier
958376bba7 new svg 2023-07-02 10:23:14 -07:00
Paul Gauthier
2915acb9a6 new svg 2023-07-02 10:23:06 -07:00
Paul Gauthier
86ced88f8e new svg 2023-07-02 10:18:58 -07:00
Paul Gauthier
633cfa6942 copy 2023-07-02 10:13:07 -07:00
Paul Gauthier
1aefebabd0 link svg image 2023-07-02 10:12:33 -07:00
Paul Gauthier
26068a9ee2 Merge remote-tracking branch 'origin/main' 2023-07-02 10:09:36 -07:00
Paul Gauthier
7674fac4a9 copy 2023-07-02 10:00:53 -07:00
paul-gauthier
b3cda38a1a
Update benchmarks.md 2023-07-02 08:34:17 -07:00
Paul Gauthier
93e29eda94 copy 2023-07-02 08:06:17 -07:00
Paul Gauthier
cef990cd98 new svg 2023-07-02 07:59:07 -07:00
Paul Gauthier
74cd311ff0 new svg 2023-07-02 07:11:10 -07:00
Paul Gauthier
db18876db6 plot the repeat error bars 2023-07-02 07:10:54 -07:00
Paul Gauthier
ecb739ed07 validate all jsonschemas 2023-07-02 06:36:42 -07:00
Paul Gauthier
0d72ee1e45 copy 2023-07-02 06:18:15 -07:00
Paul Gauthier
411c744a15 run repeats 2023-07-02 06:09:27 -07:00
Paul Gauthier
92a09f3deb copy 2023-07-01 22:03:08 -07:00
Paul Gauthier
26405457c5 copy 2023-07-01 21:56:57 -07:00
Paul Gauthier
94bc194ff7 copy 2023-07-01 21:49:21 -07:00
Paul Gauthier
a4ab262d96 new svg 2023-07-01 21:35:38 -07:00
Paul Gauthier
f548f88220 new svg 2023-07-01 21:31:54 -07:00
Paul Gauthier
e2af782b59 copy 2023-07-01 21:28:07 -07:00
Paul Gauthier
6477a95279 copy 2023-07-01 21:22:53 -07:00
Paul Gauthier
adf6929669 copy 2023-07-01 19:46:37 -07:00
Paul Gauthier
5e82455c85 copy 2023-07-01 19:09:01 -07:00
Paul Gauthier
afc7cc8f21 Merge remote-tracking branch 'origin/main' 2023-07-01 18:52:58 -07:00
Paul Gauthier
2a8a430d80 copy 2023-07-01 18:52:47 -07:00
paul-gauthier
bd710ececc
Update benchmarks.md 2023-07-01 18:25:56 -07:00
Paul Gauthier
f66e7e15e1 copy 2023-07-01 17:53:28 -07:00
Paul Gauthier
b9f8ed47f4 copy 2023-07-01 17:50:48 -07:00
Paul Gauthier
8ef166478a graph layout 2023-07-01 17:18:14 -07:00
Paul Gauthier
7db384fc63 copy 2023-07-01 17:00:57 -07:00
Paul Gauthier
3f0c752368 show 1st & 2nd coding attempts 2023-07-01 16:40:25 -07:00
Paul Gauthier
f27a869649 new svg 2023-07-01 16:23:09 -07:00
Paul Gauthier
b3741af4e5 copy 2023-07-01 15:27:44 -07:00
Paul Gauthier
ca1f149824 copy 2023-07-01 15:26:10 -07:00
Paul Gauthier
f41b4b3833 copy 2023-07-01 15:22:36 -07:00
Paul Gauthier
51bc71446e copy 2023-07-01 15:21:21 -07:00
Paul Gauthier
2c87b5b9a1 copy 2023-07-01 15:20:40 -07:00