-
Notifications
You must be signed in to change notification settings - Fork 117
test: Add unit and pytest tests, coverage config, and Makefile targets #2152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
karangattu
wants to merge
26
commits into
main
Choose a base branch
from
add-test-code-coverage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added extensive unit and pytest-based test coverage for various modules under tests/pytest and tests/unit. Introduced new Makefile targets for unit test coverage and coverage threshold checking. Updated pyproject.toml to include coverage.py configuration for source, reporting, and HTML output.
Introduces new pytest-based test modules for accordion, CSS units, fill, input select, inputs, layout/card, modal, namespaces, navsets, output, pages, tooltip/popover, types, UI helpers, validation, and valuebox components. Updates workflow to run tests with coverage and upload reports to Codecov. Expands tests for PriorityQueueFIFO and namespace utilities for improved coverage and reliability.
Introduces new pytest-based test files covering shiny.ui components (busy indicators, download buttons, input widgets, markdown, HTML dependencies, tags), shiny.module decorators and helpers, shiny.reactive core functionality, express detection, connection mocks, environment detection, and version strings. These tests improve coverage and help ensure correctness of UI rendering, module namespace resolution, reactive value handling, and dependency management.
Added new pytest-based test modules covering App class, bookmark module, input widgets (checkbox, numeric, slider, text), layout functions, markdown, module utilities, reactive, renderers, types, utils, and valuebox showcase. Also updated import order and minor import fixes in existing test files for consistency.
Introduce new pytest-based test files covering shiny.ui._accordion, shiny.ui._bootstrap, shiny.ui.busy_indicators, shiny.ui._card, and shiny.bookmark modules. These tests validate UI component creation, attribute handling, and bookmark directory logic, improving test coverage and reliability for core UI and bookmarking functionality.
Replaces usage of NamedTemporaryFile with TemporaryDirectory in multiple test files to improve file handling and cleanup. This change ensures temporary files are created and deleted reliably, and avoids issues with file access on some platforms.
This commit introduces a large suite of new and updated pytest-based tests covering module exports, type existence, and API surface for various shiny submodules, including bookmark, busy spinner, coordmap, data frame utilities, experimental features, express layout, input task button, playwright, plotutils, reactive, render, renderer, run, session, shiny utils, and UI components. The tests verify that expected classes, functions, and constants are present and correctly exported, and that deprecated or proxy modules behave as intended. Some minor cleanups were made to existing tests to remove unused imports and update import paths.
Added comprehensive pytest test files for shiny UI components (accordion, card, input, output, layout, modal, navs, sidebar, theme, etc.) and render modules (plot, table, download, code, text, ui). Also refactored import statements in existing test files for consistency and readability.
Introduces new pytest-based test files for various shiny modules, including http_staticfiles, ui CSS units, data frame output, fill containers, notifications, plot output options, progress, toast, and tooltip functionality. These tests verify module importability, function/class existence, callability, and correct export in the shiny.ui namespace.
Updated various files to wrap multi-line string arguments in parentheses for improved readability and consistency, especially for ui.markdown, ui.tags.style, and similar calls. This change standardizes formatting across examples, tests, and core modules without altering functionality.
Standardized the order of imports across multiple test files to improve readability and maintain consistency. No functional changes were made to the tests.
Added explicit type annotations to test functions, especially for fixtures like tmp_path and monkeypatch, and for handler arguments. Improved test robustness by adding type checks (e.g., isinstance assertions) before attribute access. Updated some test logic to use cast where appropriate and refactored static method calls to instance method calls in test_theme_brand.py. Also removed 'tests' from pyrightconfig.json exclude list to enable type checking in test files.
Added or refined type annotations throughout test files to improve type safety and clarity. Updated mock session helpers and test functions to use explicit types, and adjusted test logic to ensure correct typing, especially for handler signatures and test assertions. These changes enhance maintainability and help catch type-related issues during development.
Updated test cases to use asyncio.run instead of asyncio.get_event_loop().run_until_complete for running async functions. This modernizes the test code and improves compatibility with newer Python versions.
Introduces new pytest-based test suites for shiny.bookmark save/restore helpers, shiny._main_create template utilities, and shiny.run._run process helpers. These tests improve coverage for state management, template discovery, GitHub parsing, and process control logic.
Introduces new pytest-based test suites for bookmark, coordmap, express run, staticfiles, main helpers, and render plot helpers. Updates pyproject.toml coverage settings with clarifying comments. Enhances test coverage and reliability for core Shiny functionality.
Refactored tests to handle async serializer functions using asyncio.run, updated monkeypatching for async methods, and adjusted class names in test_coordmap_utils.py to follow naming conventions. Also improved test_main_generate_test_funcs.py by patching Path.cwd for better test isolation.
Refactored multiple test files to improve readability by reformatting long function calls and import statements across the test suite. Also fixed import order in test_input_update.py for consistency.
Updated multiple test files to use explicit type casting, improved monkeypatching with named functions, and enhanced type annotations for better static analysis and code clarity. These changes help ensure compatibility with stricter type checkers and improve maintainability of the test suite.
Enable parallel and multiprocessing coverage in pyproject.toml and pytest.ini, and add a Makefile target for CI coverage reporting. Add tests for _session_on_flush_send_msg in test_ui_utils.py. Minor test and import cleanups in other test files.
Added the PYTEST_XDIST variable (defaulting to '-n auto') and updated coverage-related Makefile targets to use it. This allows tests to run in parallel, improving test execution speed.
Added new test files for data frame types, input update, and session run logic. Refactored session tests by moving async session run tests to a dedicated file. Improved Makefile coverage targets for clarity and maintainability. Enhanced input file tests to cover accept parameter conversion and bookmark restore scenarios.
Rewrites and expands tests for UI insert/remove, modal, navs_dynamic, notification, and progress modules. The new tests use unittest.mock for session mocking, add coverage for more parameter combinations, and improve assertions for function behavior. This enhances reliability and maintainability of the UI-related codebase.
Added new test files for chat module, download button, and input dark mode components. Refactored and expanded tests for accordion, input numeric, input password, navs dynamic, notification, popover, and progress UI components to improve coverage and clarity. Updated test logic to use direct session mocks and modernized assertions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added extensive unit and pytest-based test coverage for various modules under tests/pytest and tests/unit. Introduced new Makefile targets for unit test coverage and coverage threshold checking. Updated pyproject.toml to include coverage.py configuration for source, reporting, and HTML output.