webdriver_test_tools.project.initialize module¶
Functions for creating a new test package.
-
webdriver_test_tools.project.initialize.
create_setup_file
(target_path, context)[source]¶ Creates setup.py for test project
- Parameters
target_path – The path to the outer directory where the package directory is contained
context – Jinja context used to render template
-
webdriver_test_tools.project.initialize.
create_readme
(target_path, context)[source]¶ Create README.rst for test project
- Parameters
target_path – The path to the outer directory where the package directory is contained
context – Jinja context used to render template
-
webdriver_test_tools.project.initialize.
create_gitignore
(target_path)[source]¶ Create .gitignore file at the root of the test project
- Parameters
target_path – The path to the outer directory where the package directory is contained
-
webdriver_test_tools.project.initialize.
create_package_directory
(target_path, package_name)[source]¶ Creates package directory for test project
- Parameters
target_path – The path to the outer directory where initialize was called
package_name – The desired name of the package
- Returns
Path to created package directory
-
webdriver_test_tools.project.initialize.
create_package_root_modules
(target_path, context)[source]¶ Creates __main__.py, __init__.py, and data.py modules for test package
- Parameters
target_path – The path to the test package directory
context – Jinja context used to render template
-
webdriver_test_tools.project.initialize.
create_test_directories
(target_path)[source]¶ Creates base directories for test writing that are initially empty.
As of version 2.2.0, this method only creates the pages/ directory.
- Parameters
target_path – The path to the test package directory
-
webdriver_test_tools.project.initialize.
create_output_directories
(target_path, gitignore_files=True)[source]¶ Creates log/ and screenshot/ directories and their .gitignore files
- Parameters
target_path – The path to the test package directory
gitignore_files – (Default = True) Copy template .gitignore files to log/ and screenshot/ directories if True
-
webdriver_test_tools.project.initialize.
create_tests_init
(target_path, context)[source]¶ Creates test package tests/ subdirectory and tests/__init__.py
- Parameters
target_path – The path to the test package directory
context – Jinja context used to render template
-
webdriver_test_tools.project.initialize.
create_config_files
(target_path, context)[source]¶ Creates test package config directory and config files
- Parameters
target_path – The path to the test package directory
context – Jinja context used to render template
-
webdriver_test_tools.project.initialize.
create_init
(target_path)[source]¶ Create an empty __init__.py file in the target path
- Parameters
target_path – The path to the directory that will contain the new __init__.py file
-
webdriver_test_tools.project.initialize.
generate_context
(test_package, project_title=None, version_badge=True)[source]¶ Returns a jinja context to use for rendering templates
- Parameters
test_package – Name of the python test package
project_title – (Default = test_package) Human-readable title for the test project. Defaults to the value of test_package if not provided
version_badge – (Default = True) Include “generated using webdriver_test_tools <version>” badge on README if True
- Returns
Dictionary to use as a context when rendering Jinja templates
-
webdriver_test_tools.project.initialize.
initialize
(target_path, package_name, project_title, gitignore_files=True, readme_file=True)[source]¶ Initializes new project package
This method assumes parameters have been validated.
main()
handles input validation before calling this function- Parameters
target_path – Path to directory that will contain test package
package_name – Name of the test package to create (will be validated)
project_title – Human readable title of the test project.
gitignore_files – (Default = True) Copy template .gitignore file to project root directory if True
readme_file – (Default = True) Render template README file to project root directory if True