diff --git a/tests/__snapshots__/test_screenshots.ambr b/tests/__snapshots__/test_screenshots.ambr index 01cd0af..0cb3f6c 100644 --- a/tests/__snapshots__/test_screenshots.ambr +++ b/tests/__snapshots__/test_screenshots.ambr @@ -22,247 +22,247 @@ font-weight: 700; } - .terminal-1049528061-matrix { + .terminal-1526063398-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1049528061-title { + .terminal-1526063398-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1049528061-r1 { fill: #c5c8c6 } - .terminal-1049528061-r2 { fill: #e0e0e0 } - .terminal-1049528061-r3 { fill: #909090 } - .terminal-1049528061-r4 { fill: #e2e3e3 } - .terminal-1049528061-r5 { fill: #211505;font-weight: bold } - .terminal-1049528061-r6 { fill: #dfdfdf } - .terminal-1049528061-r7 { fill: #fea62b;font-weight: bold } - .terminal-1049528061-r8 { fill: #919497;font-weight: bold } - .terminal-1049528061-r9 { fill: #dfdfdf;font-weight: bold } - .terminal-1049528061-r10 { fill: #e2e3e3;font-weight: bold } - .terminal-1049528061-r11 { fill: #608ab1;text-decoration: underline; } - .terminal-1049528061-r12 { fill: #919497;font-style: italic; } - .terminal-1049528061-r13 { fill: #68a0b3;font-weight: bold } - .terminal-1049528061-r14 { fill: #e2e3e3;font-style: italic; } - .terminal-1049528061-r15 { fill: #dfdfdf;font-weight: bold;text-decoration: underline; } - .terminal-1049528061-r16 { fill: #f8f8f2 } - .terminal-1049528061-r17 { fill: #e6db74 } - .terminal-1049528061-r18 { fill: #14191f } - .terminal-1049528061-r19 { fill: #84a4cc } - .terminal-1049528061-r20 { fill: #dde8f3;font-weight: bold } - .terminal-1049528061-r21 { fill: #ddedf9 } + .terminal-1526063398-r1 { fill: #c5c8c6 } + .terminal-1526063398-r2 { fill: #e0e0e0 } + .terminal-1526063398-r3 { fill: #909090 } + .terminal-1526063398-r4 { fill: #e2e3e3 } + .terminal-1526063398-r5 { fill: #211505;font-weight: bold } + .terminal-1526063398-r6 { fill: #dfdfdf } + .terminal-1526063398-r7 { fill: #fea62b;font-weight: bold } + .terminal-1526063398-r8 { fill: #919497;font-weight: bold } + .terminal-1526063398-r9 { fill: #dfdfdf;font-weight: bold } + .terminal-1526063398-r10 { fill: #e2e3e3;font-weight: bold } + .terminal-1526063398-r11 { fill: #608ab1;text-decoration: underline; } + .terminal-1526063398-r12 { fill: #919497;font-style: italic; } + .terminal-1526063398-r13 { fill: #68a0b3;font-weight: bold } + .terminal-1526063398-r14 { fill: #e2e3e3;font-style: italic; } + .terminal-1526063398-r15 { fill: #dfdfdf;font-weight: bold;text-decoration: underline; } + .terminal-1526063398-r16 { fill: #f8f8f2 } + .terminal-1526063398-r17 { fill: #e6db74 } + .terminal-1526063398-r18 { fill: #14191f } + .terminal-1526063398-r19 { fill: #84a4cc } + .terminal-1526063398-r20 { fill: #dde8f3;font-weight: bold } + .terminal-1526063398-r21 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - browsr + browsr - - - - browsr — github://juftin:browsr@v1.6.0/README.md [monokai] - 📂 github://juftin:browsr@v1.6.0/┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┣━━ 📁 .githubbrowsr - ┣━━ 📁 browsr┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - ┣━━ 📁 docs - ┣━━ 📁 requirements - ┣━━ 📁 tests🌆 browsr Version🌆 PyPI🌆 Testing Status🌆 GitHub License - ┣━━ 📄 .gitignore - ┣━━ 📄 .pre-commit-config.yamlbrowsr is a TUI (text-based user interface) file browser for your terminal. It's a simple way to browse your files and    - ┣━━ 📄 .releaserc.jstake a peek at their contents. Plus it works on local and remote file systems.                                            - ┣━━ 📄 LICENSE - ┣━━ 📄 mkdocs.yaml - ┣━━ 📄 pyproject.toml - ┗━━ 📄 README.md - - Installation - - The below command recommends pipx instead of pip. pipx installs the package in an isolated environment and makes it easy  - to uninstall. If you'd like to use pip instead, just replace pipx with pip in the below command.                          - - - pipxinstallbrowsr - - - - Extra Installation - - If you're looking to use browsr on remote file systems, like AWS S3, you'll need to install the remote extra. If you'd    - like to browse parquet files, you'll need to install the parquet extra. Or, even simpler, you can install the all extra   - to get all the extras.                                                                                                    - - - pipxinstall"browsr[all]" - - - - Usage - - ▄▄ - browsr~/Downloads/ - - - Simply give browsr a path to a file/directory and it will open a browser window with a file browser. You can also give it - a URL to a remote file system, like AWS S3.                                                                               - - - 🗄️️️  3KB  💾  README.md  📂  juftin:browsr@v1.6.0 -  Q  Quit  F  Toggle Files  T  Toggle Theme  N  Toggle Line Numbers  D  Toggle Dark Mode  .  Parent Directory  X  Download File  + + + + browsr — github://juftin:browsr@v1.6.0/README.md [monokai] + 📂 github://juftin:browsr@v1.6.0/┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┣━━ 📁 .githubbrowsr + ┣━━ 📁 browsr┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + ┣━━ 📁 docs + ┣━━ 📁 requirements + ┣━━ 📁 tests🌆 browsr Version🌆 PyPI🌆 Testing Status🌆 GitHub License + ┣━━ 📄 .gitignore + ┣━━ 📄 .pre-commit-config.yamlbrowsr is a TUI (text-based user interface) file browser for your terminal. It's a simple way to browse your files and    + ┣━━ 📄 .releaserc.jstake a peek at their contents. Plus it works on local and remote file systems.                                            + ┣━━ 📄 LICENSE + ┣━━ 📄 mkdocs.yaml + ┣━━ 📄 pyproject.toml + ┗━━ 📄 README.md + + Installation + + The below command recommends pipx instead of pip. pipx installs the package in an isolated environment and makes it easy  + to uninstall. If you'd like to use pip instead, just replace pipx with pip in the below command.                          + + + pipxinstallbrowsr + + + + Extra Installation + + If you're looking to use browsr on remote file systems, like AWS S3, you'll need to install the remote extra. If you'd    + like to browse parquet files, you'll need to install the parquet extra. Or, even simpler, you can install the all extra   + to get all the extras.                                                                                                    + + + pipxinstall"browsr[all]" + + + + Usage + + ▄▄ + browsr~/Downloads/ + + + Simply give browsr a path to a file/directory and it will open a browser window with a file browser. You can also give it + a URL to a remote file system, like AWS S3.                                                                               + + + 🗄️️️  3KB  💾  README.md  📂  juftin:browsr@v1.6.0 +  Q  Quit  F  Files  T  Theme  N  Line Numbers  D  Dark Mode  .  Parent Directory  R  Reload  C  Copy Path  X  Download File  @@ -292,235 +292,235 @@ font-weight: 700; } - .terminal-916827204-matrix { + .terminal-3353170364-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-916827204-title { + .terminal-3353170364-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-916827204-r1 { fill: #c5c8c6 } - .terminal-916827204-r2 { fill: #e0e0e0 } - .terminal-916827204-r3 { fill: #909090 } - .terminal-916827204-r4 { fill: #f8f8f2 } - .terminal-916827204-r5 { fill: #dfdfdf } - .terminal-916827204-r6 { fill: #23568b } - .terminal-916827204-r7 { fill: #84a4cc } - .terminal-916827204-r8 { fill: #dde8f3;font-weight: bold } - .terminal-916827204-r9 { fill: #ddedf9 } + .terminal-3353170364-r1 { fill: #c5c8c6 } + .terminal-3353170364-r2 { fill: #e0e0e0 } + .terminal-3353170364-r3 { fill: #909090 } + .terminal-3353170364-r4 { fill: #f8f8f2 } + .terminal-3353170364-r5 { fill: #dfdfdf } + .terminal-3353170364-r6 { fill: #23568b } + .terminal-3353170364-r7 { fill: #84a4cc } + .terminal-3353170364-r8 { fill: #dde8f3;font-weight: bold } + .terminal-3353170364-r9 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - browsr + browsr - - - - browsr — github://juftin:browsr@v1.6.0/LICENSE [monokai] - MIT License - - Copyright (c) 2023-present Justin Flannery <justin.flannery@juftin.com> - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in  - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 🗄️️️  1KB  💾  LICENSE  📂  juftin:browsr@v1.6.0 -  Q  Quit  F  Toggle Files  T  Toggle Theme  N  Toggle Line Numbers  D  Toggle Dark Mode  .  Parent Directory  X  Download File  + + + + browsr — github://juftin:browsr@v1.6.0/LICENSE [monokai] + MIT License + + Copyright (c) 2023-present Justin Flannery <justin.flannery@juftin.com> + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in  + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 🗄️️️  1KB  💾  LICENSE  📂  juftin:browsr@v1.6.0 +  Q  Quit  F  Files  T  Theme  N  Line Numbers  D  Dark Mode  .  Parent Directory  R  Reload  C  Copy Path  X  Download File  @@ -550,238 +550,237 @@ font-weight: 700; } - .terminal-2736181454-matrix { + .terminal-1629039305-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2736181454-title { + .terminal-1629039305-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2736181454-r1 { fill: #c5c8c6 } - .terminal-2736181454-r2 { fill: #e0e0e0 } - .terminal-2736181454-r3 { fill: #909090 } - .terminal-2736181454-r4 { fill: #959077 } - .terminal-2736181454-r5 { fill: #dfdfdf } - .terminal-2736181454-r6 { fill: #ff4689 } - .terminal-2736181454-r7 { fill: #f8f8f2 } - .terminal-2736181454-r8 { fill: #e6db74 } - .terminal-2736181454-r9 { fill: #14191f } - .terminal-2736181454-r10 { fill: #84a4cc } - .terminal-2736181454-r11 { fill: #dde8f3;font-weight: bold } - .terminal-2736181454-r12 { fill: #ddedf9 } + .terminal-1629039305-r1 { fill: #c5c8c6 } + .terminal-1629039305-r2 { fill: #e0e0e0 } + .terminal-1629039305-r3 { fill: #909090 } + .terminal-1629039305-r4 { fill: #959077 } + .terminal-1629039305-r5 { fill: #dfdfdf } + .terminal-1629039305-r6 { fill: #ff4689 } + .terminal-1629039305-r7 { fill: #f8f8f2 } + .terminal-1629039305-r8 { fill: #e6db74 } + .terminal-1629039305-r9 { fill: #84a4cc } + .terminal-1629039305-r10 { fill: #dde8f3;font-weight: bold } + .terminal-1629039305-r11 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - browsr + browsr - - - - browsr — github://juftin:browsr@v1.6.0/mkdocs.yaml [monokai] - # schema: https://squidfunk.github.io/mkdocs-material/schema.json - - site_name:browsr                                                                                                                                              - nav: - -index.md                                                                                                                                                 - -Command Line Interface ⌨️:cli.md                                                                                                                         - -Contributing 🤝:contributing.md                                                                                                                         - -API Documentation 🤖:reference/                                                                                                                         - theme: - favicon:https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/browsr_no_label.png                                                             - logo:https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/browsr_no_label.png                                                                - name:material                                                                                                                                             - features: - -navigation.tracking                                                                                                                                  - -content.code.annotate                                                                                                                                - -content.code.copy                                                                                                                                    - palette: - -media:"(prefers-color-scheme:light)" - scheme:default                                                                                                                                      - accent:purple                                                                                                                                       - toggle: - icon:material/weather-sunny                                                                                                                     - name:Switch to dark mode                                                                                                                        - -media:"(prefers-color-scheme:dark)" - scheme:slate                                                                                                                                        - primary:black                                                                                                                                       - toggle: - icon:material/weather-night                                                                                                                    ▅▅ - name:Switch to light mode                                                                                                                       - repo_url:https://github.com/juftin/browsr                                                                                                                     - repo_name:browsr                                                                                                                                              - edit_uri:blob/main/docs/                                                                                                                                      - site_author:Justin Flannery                                                                                                                                   - remote_branch:gh-pages                                                                                                                                        - copyright:Copyright © 2023 Justin Flannery                                                                                                                    - extra: - generator:false                                                                                                                                           - markdown_extensions: - -toc: - permalink:"#" - -pymdownx.snippets                                                                                                                                        - -pymdownx.magiclink                                                                                                                                       - -attr_list                                                                                                                                                - -md_in_html                                                                                                                                               - -pymdownx.highlight: - 🗄️️️  2KB  💾  mkdocs.yaml  📂  juftin:browsr@v1.6.0 -  Q  Quit  F  Toggle Files  T  Toggle Theme  N  Toggle Line Numbers  D  Toggle Dark Mode  .  Parent Directory  X  Download File  + + + + browsr — github://juftin:browsr@v1.6.0/mkdocs.yaml [monokai] + # schema: https://squidfunk.github.io/mkdocs-material/schema.json + + site_name:browsr                                                                                                                                              + nav: + -index.md                                                                                                                                                 + -Command Line Interface ⌨️:cli.md                                                                                                                         + -Contributing 🤝:contributing.md                                                                                                                         + -API Documentation 🤖:reference/                                                                                                                         + theme: + favicon:https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/browsr_no_label.png                                                             + logo:https://raw.githubusercontent.com/juftin/browsr/main/docs/_static/browsr_no_label.png                                                                + name:material                                                                                                                                             + features: + -navigation.tracking                                                                                                                                  + -content.code.annotate                                                                                                                                + -content.code.copy                                                                                                                                    + palette: + -media:"(prefers-color-scheme:light)" + scheme:default                                                                                                                                      + accent:purple                                                                                                                                       + toggle: + icon:material/weather-sunny                                                                                                                     + name:Switch to dark mode                                                                                                                        + -media:"(prefers-color-scheme:dark)" + scheme:slate                                                                                                                                        + primary:black                                                                                                                                       + toggle: + icon:material/weather-night                                                                                                                     + name:Switch to light mode                                                                                                                       + repo_url:https://github.com/juftin/browsr                                                                                                                     + repo_name:browsr                                                                                                                                              + edit_uri:blob/main/docs/                                                                                                                                      + site_author:Justin Flannery                                                                                                                                   + remote_branch:gh-pages                                                                                                                                        + copyright:Copyright © 2023 Justin Flannery                                                                                                                    + extra: + generator:false                                                                                                                                           + markdown_extensions: + -toc: + permalink:"#" + -pymdownx.snippets                                                                                                                                        + -pymdownx.magiclink                                                                                                                                       + -attr_list                                                                                                                                                + -md_in_html                                                                                                                                               + -pymdownx.highlight: + 🗄️️️  2KB  💾  mkdocs.yaml  📂  juftin:browsr@v1.6.0 +  Q  Quit  F  Files  T  Theme  N  Line Numbers  D  Dark Mode  .  Parent Directory  R  Reload  C  Copy Path  X  Download File  diff --git a/tests/conftest.py b/tests/conftest.py index 1ffc246..73123e2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,6 +5,7 @@ import pathlib from typing import Any, Dict, List +import pyperclip import pytest from click.testing import CliRunner from textual_universal_directorytree import GitHubPath @@ -44,6 +45,16 @@ def github_release_path() -> GitHubPath: return GitHubPath(uri) +@pytest.fixture(autouse=True) +def copy_supported(monkeypatch: pytest.MonkeyPatch) -> None: + """ + Override _copy_supported + """ + monkeypatch.setattr( + pyperclip, "determine_clipboard", lambda: (lambda: True, lambda: True) + ) + + @pytest.fixture(scope="module") def vcr_config() -> Dict[str, List[Any]]: """ diff --git a/tests/debug_app.py b/tests/debug_app.py new file mode 100644 index 0000000..2182a09 --- /dev/null +++ b/tests/debug_app.py @@ -0,0 +1,19 @@ +""" +App Debugging +""" + +import pytest + +from browsr.base import TextualAppContext +from browsr.browsr import Browsr + + +@pytest.mark.asyncio +async def test_debug_app() -> None: + """ + Test the actual browsr app + """ + config = TextualAppContext(file_path="s3://", debug=True) + app = Browsr(config_object=config) + async with app.run_test() as pilot: + _ = pilot.app diff --git a/tests/test_browsr.py b/tests/test_browsr.py new file mode 100644 index 0000000..a637833 --- /dev/null +++ b/tests/test_browsr.py @@ -0,0 +1,18 @@ +""" +Test the actual browsr app +""" + +import pytest + +from browsr.base import TextualAppContext +from browsr.browsr import Browsr + + +def test_bad_path() -> None: + """ + Test a bad path + """ + with pytest.raises(FileNotFoundError): + _ = Browsr( + config_object=TextualAppContext(file_path="bad_file_path.csv", debug=True) + ) diff --git a/tests/test_cli.py b/tests/test_cli.py index 92adb6c..9f59b98 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,7 +4,7 @@ from click.testing import CliRunner -from browsr._cli import browsr +from browsr.cli import browsr def test_cli_main(runner: CliRunner) -> None: diff --git a/tests/test_config.py b/tests/test_config.py index c30f655..ce3edb9 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -6,8 +6,8 @@ from textual_universal_directorytree import GitHubPath -from browsr._base import TextualAppContext -from browsr._config import favorite_themes +from browsr.base import TextualAppContext +from browsr.config import favorite_themes from tests.conftest import cassette diff --git a/tests/test_screenshots.py b/tests/test_screenshots.py index 4387039..fb0fa09 100644 --- a/tests/test_screenshots.py +++ b/tests/test_screenshots.py @@ -15,8 +15,8 @@ @pytest.fixture def app_file() -> str: file_content = """ - from browsr import Browsr - from browsr._base import TextualAppContext + from browsr.browsr import Browsr + from browsr.base import TextualAppContext file_path = "{file_path}" context = TextualAppContext(file_path=file_path)