Commit graph

2111 commits

Author SHA1 Message Date
Paul Gauthier
76eb9e020f more windows test improvements 2023-07-05 14:01:59 -07:00
Paul Gauthier
bbd68097bd tests run on windows now 2023-07-05 13:59:31 -07:00
Paul Gauthier
ae5b4057e8 Merge remote-tracking branch 'origin/main' 2023-07-05 13:39:49 -07:00
Paul Gauthier
9ed19e63d0 bugfix 2023-07-05 13:36:00 -07:00
Paul Gauthier
21efc8d59e convert git.ls_files() to appropriate os.sep, since git always normalizes to / 2023-07-05 13:29:13 -07:00
Paul Gauthier
83887070f4 copy 2023-07-05 13:26:07 -07:00
Paul Gauthier
77a230f005 improved windows instructions, error message 2023-07-05 10:27:07 -07:00
Paul Gauthier
4317a41cd2 copy 2023-07-05 10:00:26 -07:00
Paul Gauthier
b54fc10ee0 Explain -m aider.main in README 2023-07-05 09:59:22 -07:00
paul-gauthier
cdf8f9a4b2
Merge pull request #49 from kwmiebach/main
Add program argument for syntax highlighting theme.
2023-07-05 06:46:04 -07:00
kwmiebach
b80c83c6cb Add program argument for syntax highlighting theme.
The source code output in the chat will be colored in the given
color scheme. Syntax highlighting is powered by pygments, which
supports many styles out of the box. For example:

- default (the default)
- dracula
- emacs
- github-dark
- monokai
- vim
- solarized-dark
- solarized-light

See https://pygments.org/styles/
2023-07-05 00:29:40 +02:00
Paul Gauthier
bc6e958d7e aider: Remove push and pull_request triggers, add workflow_dispatch trigger to make the GitHub action only run when manually initiated.
# Context:
USER: can you stop this action from running on pushes/merges and make it so that it only runs when manually initiated?
ASSISTANT: Sure, to make the GitHub action only run when manually initiated, we need to modify the `.github/workflows/windows-tests.yml` file. We will remove the `push` and `pull_request` triggers and add a `workflow_dispatch` trigger.

Here is the change:

```yaml
.github/workflows/windows-tests.yml
<<<<<<< ORIGINAL
name: Windows Tests

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
=======
name: Windows Tests

on:
  workflow_dispatch:
>>>>>>> UPDATED
```

This change will make the workflow only run when manually triggered from the GitHub Actions UI.
2023-07-04 14:49:16 -07:00
Paul Gauthier
37e8c49f7a aider: Added step to install universal ctags using Chocolatey before installing Python dependencies.
# Context:
USER: we do need to install universal ctags on windows too
ASSISTANT: To install universal ctags on Windows, we need to modify the `windows-tests.yml` file. However, universal ctags is not available in the standard repositories used by GitHub Actions' Windows environment. We can use Chocolatey, a package manager for Windows, to install universal ctags.

Here are the changes:

```yaml
.github/workflows/windows-tests.yml
<<<<<<< ORIGINAL
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
=======
    - name: Install universal ctags
      run: |
        choco install universal-ctags

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
>>>>>>> UPDATED
```

This adds a new step to the workflow to install universal ctags using Chocolatey before installing the Python dependencies.
2023-07-04 14:43:34 -07:00
Paul Gauthier
2cdeae8fdd aider: Create a Windows workflow for running tests based on the existing Python workflow.
# Context:
USER: make a windows workflow to run the tests, based on the existing python workflow
ASSISTANT: To create a Windows workflow for running tests, we can use the existing Python workflow as a base. We will need to modify the `runs-on` field to specify a Windows environment, and adjust the commands for installing dependencies and running tests to be compatible with Windows.

Here are the changes:

```yaml
.github/workflows/windows-tests.yml
<<<<<<< ORIGINAL

=======
name: Windows Tests

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: windows-latest
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11"]

    steps:
    - name: Check out repository
      uses: actions/checkout@v3

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run tests
      run: |
        python -m unittest discover -s tests
>>>>>>> UPDATED
```

This creates a new file `.github/workflows/windows-tests.yml` with the necessary configuration for running tests on a Windows environment. The Python version matrix, checkout, setup, and test steps are the same as in the original Python workflow. The command to install dependencies has been simplified, as the `universal-ctags` package is not required or available on Windows.
2023-07-04 14:42:53 -07:00
Paul Gauthier
8596a5725f Added new files to the git repo: .github/workflows/windows-tests.yml 2023-07-04 14:42:11 -07:00
Paul Gauthier
9c45e01354 restore ubuntu 2023-07-04 14:41:40 -07:00
Paul Gauthier
6d70e3aa57 Just windows 2023-07-04 14:40:09 -07:00
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