Commit graph

2344 commits

Author SHA1 Message Date
Paul Gauthier
4d41964531 aider: Added Windows image for running tests and modified the 'Install universal ctags' step to work on both Ubuntu and Windows.
# Context:
USER: can we add a github action to also run tests on a windows image?
ASSISTANT: Sure, to add a GitHub action to run tests on a Windows image, we need to modify the GitHub actions workflow file. This file is usually located in the `.github/workflows` directory and has a `.yml` or `.yaml` extension.

Could you please provide the *read-write* access to the GitHub actions workflow file?
USER: I added these *read-write* files: .github/workflows/python-tests.yml
ASSISTANT: Great! We will modify the `.github/workflows/python-tests.yml` file to add a Windows image for running tests.

Here are the steps:

1. Add 'windows-latest' to the `runs-on` field under the `strategy` section. This will ensure that the tests are run on both Ubuntu and Windows environments.

Here is the *edit block* for the change:

```yaml
.github/workflows/python-tests.yml
<<<<<<< ORIGINAL
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11"]
=======
jobs:
  build:
    runs-on: [ubuntu-latest, windows-latest]
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11"]
>>>>>>> UPDATED
```

2. Modify the 'Install universal ctags' step to work on both Ubuntu and Windows. For Windows, we will use Chocolatey to install universal ctags.

Here is the *edit block* for the change:

```yaml
.github/workflows/python-tests.yml
<<<<<<< ORIGINAL
    - name: Install universal ctags
      run: |
        sudo apt-get update
        sudo apt-get install -y universal-ctags
=======
    - name: Install universal ctags
      run: |
        if [[ "${{ runner.os }}" == "Windows" ]]; then
          choco install universal-ctags
        else
          sudo apt-get update
          sudo apt-get install -y universal-ctags
        fi
>>>>>>> UPDATED
```

Please review these changes and let me know if they are acceptable.
2023-07-04 14:18:38 -07:00
Paul Gauthier
61247ec499 Added recheck_abs_fnames to notice if files go missing 2023-07-04 14:11:05 -07:00
Paul Gauthier
5d18ebd724 fixed file not found in autocompleter, issue #30 2023-07-04 12:38:36 -07:00
Paul Gauthier
4373006137 aider: Added a test for AutoCompleter that passes in a non-existent file and checks that self.words is an empty set.
# Context:
USER: add a test for `AutoCompleter` that passes in a non-existant file. make sure self.words is empty.
ASSISTANT: To add a test for `AutoCompleter` that passes in a non-existent file, we need to modify the `tests/test_io.py` file. We will add a new test method `test_autocompleter_with_non_existent_file` in the `TestInputOutput` class.

Here is the change:

```python
tests/test_io.py
<<<<<<< ORIGINAL
import os
import unittest
from unittest.mock import patch

from aider.io import InputOutput

class TestInputOutput(unittest.TestCase):
    def test_no_color_environment_variable(self):
        with patch.dict(os.environ, {"NO_COLOR": "1"}):
            io = InputOutput()
            self.assertFalse(io.pretty)

if __name__ == "__main__":
    unittest.main()
=======
import os
import unittest
from unittest.mock import patch

from aider.io import InputOutput, AutoCompleter

class TestInputOutput(unittest.TestCase):
    def test_no_color_environment_variable(self):
        with patch.dict(os.environ, {"NO_COLOR": "1"}):
            io = InputOutput()
            self.assertFalse(io.pretty)

    def test_autocompleter_with_non_existent_file(self):
        root = ""
        rel_fnames = ["non_existent_file"]
        addable_rel_fnames = []
        commands = None
        autocompleter = AutoCompleter(root, rel_fnames, addable_rel_fnames, commands)
        self.assertEqual(autocompleter.words, set())

if __name__ == "__main__":
    unittest.main()
>>>>>>> UPDATED
```

This new test creates an instance of `AutoCompleter` with a non-existent file and checks that `self.words` is an empty set.
2023-07-04 12:37:23 -07:00
paul-gauthier
c0fd590c6e
Merge pull request #46 from eltociear/patch-1
Fix typo in add-test.md
2023-07-04 12:25:42 -07:00
Ikko Eltociear Ashimine
54ccda71c8
Fix typo in add-test.md
InputOuput -> InputOutput
2023-07-05 01:19:26 +09:00
Paul Gauthier
166ecdcbd0 Updated README 2023-07-03 13:30:40 -07:00
Paul Gauthier
56f6f74832 updated tests 2023-07-03 10:51:47 -07:00
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