mirror of
https://github.com/Hopiu/bowser.git
synced 2026-03-16 19:10:24 +00:00
- Add tests for URL parsing, cookies, HTML/CSS parsing - Add tests for browser/tab management and history - Add tests for layout and rendering components - Configure pytest with coverage reporting - Add test documentation and runner commands - All 54 tests passing
1.1 KiB
1.1 KiB
Bowser Test Suite
This directory contains the test suite for the Bowser browser.
Running Tests
Run all tests:
uv run pytest
Run with verbose output:
uv run pytest -v
Run specific test file:
uv run pytest tests/test_browser.py
Run with coverage:
uv run pytest --cov=src --cov-report=html
View coverage report:
open htmlcov/index.html
Test Organization
test_url.py- URL parsing and resolutiontest_parser.py- HTML/CSS parsingtest_browser.py- Browser and tab managementtest_cookies.py- Cookie jar functionalitytest_layout.py- Layout engine componentstest_render.py- Rendering primitivesconftest.py- Shared fixtures and configuration
Writing Tests
Tests use pytest. Example:
def test_feature():
# Arrange
obj = MyClass()
# Act
result = obj.method()
# Assert
assert result == expected
Use mocks for GTK components:
@patch('src.browser.browser.Gtk')
def test_with_gtk(mock_gtk):
browser = Browser()
# test code