Saravanan666/pypi-org huggingface dataset:
Package: pytest-custom-scheduling
pytest-custom-scheduling: pytest pluginRewrite pytest-xdist pytest_xdist_make_scheduler function, Modify load scheduling.Support custom grouping.Rename testcases name and testcases nodeid, support allure report.Change testcases nodeid and testcases name encoding to UTF-8 and unicode escapeFormat:name: idsnodeid:group_name::idsinstallpip installpytest-custom-schedulingUsagecommand line:pytest--switch={on:off}--rename={on:off}-n=autotip: pytest-xdist must be turned onoptions:switch: Used to open plugin, default “off”rename: Used to open rename, default “off”Use{...}as a marker custom grouping.Support “{ filename::classname }” format for multi-level settingsDemoimportpytest@pytest.mark.parametrize("group",["group_1","group_2","group_3","group_4","group_5","group_6","group_7","group_8","group_9","group_10","group_11","group_12"],ids=["group_1{group_1}","group_2{group_2}","group_3{group_3}","group_4{group_4}","group_5{group_5}","group_6{group_6}","group_7{group_7}","group_8{group_8}","group_9{group_9}","group_10{group_10}","group_11{group_11}","group_12{group_12}"])@pytest.mark.parametrize("group",["group_4","group_5","group_6"],ids=["group_4{group_5}","group_5{group_5}","group_6{group_5}"])deftest_05(group):a="hello"b="world"asserta==bcmd line:pytest--switch=on--rename=on-n=auto
Package: pytestcwd
pytestcwdA simple wrapper around pytest to add current working dir tosys.path.Working as a replacement forpython -m pytest testswhenpytest testswon't find your module in current working dir.InstallationYou can usepipxand havepytestcwdglobally available via command line:pipx install pytestcwdIf you prefer you can also use pip:pip install pytestcwdUsagepytestcwd testsv0.1.0
Package: pytest-cython
OverviewThispytestplugin allows for the doctesting of C extension modules for
Python, specifically created throughcython.InstallationYou can install "pytest-cython" viapipfromPyPI:pipinstallpytest-cythonUsageBasic usage:pytest--doctest-cythonYou can also run the doctests for a single.pyxfile as such:pytest--doctest-cythonpath/to/module.pyxNoteIt is assumed that the C extension modules have been build in place before runningpy.testand there is a
matching Cython.pyxfileIssuesIf you encounter any problems, pleasefile an issuealong with a
detailed description.AcknowledgementsThispytestplugin was generated withcookiecutteralong with@hackebrot'scookiecutter-pytest-pluginand@ionelmc'scookiecutter-pylibrarytemplates.
Package: pytest-darker
RequirementsPytestDarkerThere is a minimum requirement ofDarker1.1.0 later.Installation$ pip install pytest-darkerUsageTo run pytest with checks provided byDarker:$ pytest --darkerThe plugin will output a diff of suggested formatting changes fromBlack(if any exist).
Changes will _not_ be applied automatically.Customizing Black and isort behaviorProject-specific default options forBlackandisortare read from the project’spyproject.tomlfile in the repository root.isortalso looks for a few other places for configuration.For more details, see:Black documentation about pyproject.tomlBlack example configurationisort documentation about config filesTestingTo run the tests against a selection of Python interpreters:$ toxTo run against a specific interpreter (e.g. Python 3.6):$ tox -e py36Thetox.inifile in the root of this repository
is used to configure the test environment.LicenseDistributed under the terms of theBSDlicense,pytest-darkeris free and open source software.IssuesIf you encounter any problems, please file an issue
in thepytest-darker issue trackeralong with a detailed description.GitHub stars trend
Package: pytest-dash
pytest-dashPytestplugin forDash. Pytest-dash aims to ease automated testing of dash applications and components.InstallInstall with pip:$ pip install -U pytest-dashFeaturesFixtures to startDashapplications and closes them in teardown.Declarative behavior test api in a yaml format.Selenium wait for wrappers.DocumentationFor full documentation and examples, please seehttps://pytest-dash.readthedocs.io/en/latest/usage.htmlBugs/SuggestionsFor any bug, suggestion or request, please open aGitHub issue.More resourcesDash user guidePytest
Package: pytest-datadir
pytest-datadirpytest plugin for manipulating test data directories and files.Usagepytest-datadir will look up for a directory with the name of your module or the global 'data' folder.
Let's say you have a structure like this:.
├── data/
│   └── hello.txt
├── test_hello/
│   └── spam.txt
└── test_hello.pyYou can access the contents of these files using injected variablesdatadir(fortest_folder) orshared_datadir(fordatafolder):deftest_read_global(shared_datadir):contents=(shared_datadir/"hello.txt").read_text()assertcontents=="Hello World!\n"deftest_read_module(datadir):contents=(datadir/"spam.txt").read_text()assertcontents=="eggs\n"pytest-datadir will copy the original file to a temporary folder, so changing the file contents won't change the original data file.Bothdatadirandshared_datadirfixtures arepathlib.Pathobjects.LicenseMIT.
Package: pytest-datadir-mgr
Thedatadir-mgrplugin forpytestprovides thedatadir_mgrfixture which
allow test functions to easily download data files and cache generated data files
in data directories in a manner that allows for overlaying of results.datadir-mgris pathlib-based, so complete paths to data files are handled,
not just filenames.This plugin behaves like a limited dictionary, withdatadir_mgr[item]returning a path
with the most specific scope (out ofglobal, module, [class], [function]that matches
the string or path specified byitem.  In addition to serving data files already stored
in the data directory, the fixture provides five methods useful for adding to the test data
stored in the repository:Thedownloadmethod allows downloading data files into data directories, with
option MD5 checksum checks, un-gzipping, and a progressbar.Thesavepathfixture lets an arbitrary path relative to the current working
directory to be saved at a particular scope in the data directories.Theadd_scopemethod lets one add directories from scopes different from
the present request to be added to the search path.  This lets the results
of previous cached steps to be used in scopes other than global.Thein_tmp_dirmethod creates a context in a temporary directory with
a list of request file paths copied in.  Optionally, all output file paths
can be saved at a particular scope at cleanup with an optional exclusion
filter pattern (e.g., for excluding log files).  Note that files in directories
that begin withtest_or end with_testcould be confused with
scope directories and cannnot be saved.  Ifprogressbaris set to “True”,
then the progress of file copying will be shown, which is helpful in some long-running
pytest jobs, e.g. on Travis.Thepaths_from_scopereturns a list of all paths to files from a specified scope.PrerequisitesPython 3.6 or greater is required.  This package is tested under Linux, MacOS, and Windows
using Python 3.9.
Package: pytest-data-extractor
pytest-data-extractorPytest plugin intended for extracting test data and metadata and serializing it into a file.
The plugin currently support json files.This is a completely open source project so everyone are more than welcome to join and extended it.Version 0.1.7Use casepip install the package to your project's virtual environment. Directly from plugin folder:pipinstall-e.or pip install it from Pypi:pipinstallpytest-data-extractorGo to a test file and now simply add upload_manager fixture in order to save a variable (except callable), Like so:# test_foo.pydeftest_bar(upload_manager):expected_value=upload_manager(1000)assertexpected_value==1000,"assert failed"Activate the plugin with the pytest cli with the command:pytest--output_test_dataTrueNow the data passed to upload_manager, as well as the test data that is specified at the TestData container will be
stored in an external file. For a json file output:[{"test_input":[{"test_file_path":"_20220719_21_00_10_806534.csv","file_type":"csv"}],"expected_result":null,"actual_result":null,"test_operator":null,"test_func":"test_bar","test_status":1,"test_duration":0.046707000000000054,"meta_data":null}]In version 0.1.7 there's no recording of the expected_result, actual_result and test_operator since the test result is a PASS.
Additionally, all objects passed to the upload_manager fixture will be saved as an external file that will be associated by test_file_path param.There's no garbage collection so be mindful how and where the files are stored.MiscellaneousFor order sakes, the plugin will use a test comparison convention of:* left- actual result.
* right- expected result.conftest.py hooks and fixturesIn order to change the folder for either cache or output files, use conftest.py with the correct fixtures. example:# conftest.pyimportpytest@pytest.fixturedefsuite_output_dir():return"my_files.output"@pytest.fixturedefsuite_cache_dir():return"my_files.temp"@pytest.fixturedefsuite_output_file_prefix():return"my_special_prefix"EnumerationBy default there are 3 values for the test values in the data_containers.py file:classTestStatus(Enum):Skip=-1Fail=0Pass=1The default directories will be at the root where the pytest is called.
Supports automatic pipeline
Package: pytest-datafixtures
https://github.com/idlesign/pytest-datafixturesDescriptionData fixtures for pytest made simpleOffers fixtures for your tests to simplify data fixtures access.
Makes use of Python’s nativePathobjects.Data fixtures (files) expected to be stored indatafixturesdirectory next to your test modules:tests
|-- datafixtures
|-- test_basic.py
|
|-- subdirectory
|---- datafixtures
|---- test_other.pyFixturesdatafix_dir- Path object for data fixtures directory from the current test module’s directory.datafix- Path object for a file in data fixtures directory with the same name as the current test function.datafix_read- Returns text contents of a data fixture by it’s name.datafix_readbin- Returns binary contents of a data fixture by it’s name.datafix_dirAccess data fixtures directory:deftest_me(datafix_dir):# datafix_dir returns a Path object.assertdatafix_dir.exists()# Gather data fixtures filenames.files=list(f'{file.name}'forfileindatafix_dir.iterdir())# Read some fixture as text.# The same as using `datafix_read` fixture (see below).filecontent=(datafix_dir/'expected.html').read_text()# Or read binary.filecontent=(datafix_dir/'dumped.bin').read_bytes()datafixAccess a data fixture with test name:deftest_me(datafix):# Read datafixtures/test_me.txt filefilecontents=datafix.with_suffix('.txt').read_text()datafix_readAccess text contents of a data fixture by it’s name:deftest_datafix_read(datafix_read):# Read datafixtures/expected.html filefilecontents=datafix_read('expected.html')# Read encoded and represent as an StringIO object.encoded_io=datafix_read('test_datafix.txt',encoding='cp1251',io=True)datafix_readbinAccess text contents of a data fixture by it’s name:deftest_datafix_read(datafix_readbin):# Read datafixtures/dumped.bin filebinary=datafix_readbin('dumped.bin')# Read binary and represent as an BytesIO object.bin_io=datafix_readbin('dumped.bin',io=True)RequirementsPython 3.6+
Package: pytest-data-from-files
OverviewA pytest plugin to provide fixtures to load test data from files automatically.UsageFixturesThis plugin provides following fixtures for each test modules.test_data_infotest_data_infoprovides a namedtuple object,data_from_files.ModuleInfo,
has the following values for each test modules.root: test root dir, <package_dir>/tests/ by default and is configurable with –test-root (test_root) option.datadir: test data dir using the fixture will be searched under <root>/<test_data_dirname>/,  where test_data_dirname is configurable with –test-data-dirname option.if the test code using the fixture is tests/test_foo.py, then datadir becomes tests/data/foo/if the test code using the fixture is tests/foo/bar/test_baz.py, then datadir becomes tests/data/foo/bar/bazsubdirs: names of sub dirs relative to datadir if such dirs exist.test_datatest_dataprovides a list of or a list of lists of namedtuple objects,data_from_files.DataInfo, has the following values.data: data loaded from a file <path> under <datadir>path: a file path contains the datadatadir: dir contains the test data fileOptions–test-root: test root dir where test data are seached [<package_dir>/tests]–test-data-dirname: test data dir name [data]–test-data-pattern: test data file path pattern relative to datadir [**/*.*]Examplestests/test_plugin.py and test data under tests/data/plugin/tests/test_plugin_no_data.py and test data under tests/data/plugin_no_datatests/foo/test_bar.py and test data under tests/data/foo/barInstallationRequirementspytest obviouslyPyYAML[1]is optionally required to load data from YAML filesanyconfig[2]is optionally required to load data in formats anyconfig and/or its plugins support.[1]PyYAML:https://pyyaml.org[2]anyconfig:https://github.com/ssato/python-anyconfigHow to installPyPI:pip install pytest_data_from_filesFrom git repo:pip install git+https://github.com/ssato/pytest-data-from-filesBuild wheel and install it:tox -e dists && pip install dist/pytest_data_from_files-*.whl
Package: pytest-datarecorder
Testing code that generates output can be tedious to maintainpytest-datarecorderaims to simplify this task.Table of Contents:InstallationUsageRelase new versionSource codeDeveloper NotesTestsNotesInstallationTo install pytest-datarecorder:pip install pytest-datarecorderUsageTo make it easy to use in with py.test the DataRecorder object can be
injected into a test function by using the datarecorder fixture.Example:def test_this_function(datarecorder):

    datarecorder.record_data(
        data={'a':1, 'b':2}, recording_file="test/data/recording.json")Thedatapassed will be serialized to JSON since the recording file
has a.jsonextension. Ifdatachanges, we will get an exception
containing a diff with what changed. If we want to accept the changes
we simply delete the recording and run the code again.Relase new versionEdit NEWS.rst and wscript (set correct VERSION)Run./waf uploadSource codeThe main functionality is found insrc/datarecorder.pyand the
corresponding unit test is intest/test_datarecorder.pyif you
want to play/modify/fix the code this would, in most cases, be the place
to start.Developer NotesWe try to make our projects as independent as possible of a local system setup.
For example with our native code (C/C++) we compile as much as possible from
source, since this makes us independent of what is currently installed
(libraries etc.) on a specific machine.To “fetch” sources we use Waf (https://waf.io/) augmented with dependency
resolution capabilities:https://github.com/steinwurf/wafThe goal is to enable a work-flow where running:./waf configure
./waf build --run_testsConfigures, builds and runs any available tests for a given project, such that
you as a developer can start hacking at the code.For Python project this is a bit unconventional, but we think it works well.TestsThe tests will run automatically by passing--run_teststo waf:./waf --run_testsThis follows what seems to be “best practice” advise, namely to install the
package in editable mode in a virtualenv.NotesWhy use ansrcfolder (https://hynek.me/articles/testing-packaging/).
tl;dr you should run your tests in the same environment as your users would
run your code. So by placing the source files in a non-importable folder you
avoid accidentally having access to resources not added to the Python
package your users will install…Python packaging guide:https://packaging.python.org/distributing/
Package: pytest-data-suites
pytest-data-suitesClass-based test cases forpytest.Installationpipinstallpytest-data-suitesUsage examplefrompytest_data_suitesimportDataSuiteclassMultiplicationDataSuite(DataSuite):# Using TypedDict instead of dict here could clarify your code, but that's just a demopositive_operands=dict(left_operand=2,right_operand=2,operation_result=4)negative_operands=dict(left_operand=-3,right_operand=-7,operation_result=21)@MultiplicationDataSuite.parametrizedeftest_multiplication(left_operand:float,right_operand:float,operation_result:float)->None:assertleft_operand*right_operand==operation_result
Package: pytest-datatest
The development version ofdatatest’s pytest integration.Typically, only developers working on datatest’s pytest plugin
should install this package. Other users are encouraged to install
justdatatest—this plugin comes bundled with it.Requirementspytest(3.3 or newer)datatest(0.9.0 or newer)InstallationFor DevelopersClone the git repositories and usepipto perform an
editable install from the cloned project directory:git clone git@github.com:shawnbrown/datatest.git
git clone git@github.com:shawnbrown/pytest-datatest.git
pip install --editable ./datatest
pip install --no-deps --editable ./pytest-datatestFor UsersDon’t install this package—installdatatestinstead:pip install datatestFor Users With Special RequirementsIf you aren’t a datatest or plugin developer but instead need
bug-fixes or features that are not yet available from the main
datatest project, you can install “pytest-datatest” via pip
fromPyPI:pip install datatest
pip install pytest-datatestAnd if the version is PyPI isn’t new enough for your needs, you can
install the plugin directly from the live GitHub repository (make
sure to check that the build is “passing” before doing this):pip install datatest
pip install --upgrade https://github.com/shawnbrown/pytest-datatest/archive/master.zipUsageWhen installed, this development version automatically overrides
datatest’s bundled pytest integration. If you want to revert back
to the bundled plugin, simply uninstall this version.To disable the development version (and temporarily enable the
bundled version) use:pytest -p no:datatest_develTo disable both the developmentandbundled versions use:pytest -p no:datatest_devel -p no:datatestFeaturesProvides a ‘mandatory’ marker to support incremental testing.Provides an ‘–ignore-mandatory’ command line option to override
the default ‘mandatory’ behavior.Strips the leading “E   “ prefix fromValidationErrordifferencesto help users more easily repurpose parts of the error  message forallowed.specific(...)definitions.LicenseDistributed under the terms of theMITlicense, “pytest-datatest” is
free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a
detailed description.
Package: pytest-db-plugin
pytest db pluginuploading test stdout & stderr to a DB for easy debugging and comparisonInstalltionfor es db client:pip install pytest-db[es]for only default (local files) db client:pip install pytest-dbFlowpytest test endspytest test teardown startsplugin startsplugin connects to DBplugin collects all sourcesplugin uploads all sourcesplugin ends DB connectionplugin endsInvocationpytest ...as long as the plugin is installed, and the url is provided, the plugin will attempt to uploadif the plugin is installed but a config file is not present / malformed / missing url, a warning will be displayed in the end of the testConfigurationminimaloptionalnot having one will not break the testnot having one will mean nothing is uploaded UNLESS the url param is
passed in the invocation commanda default db client will be used in such cases and the data will be written into "/tmp"will be located in invocation directoryname: ".config.toml"allows for customizing:DB url and authenticationDB interaction failure should fail test [default: false]toml format (seeexample)seesupported dbsCompitabilitypython3.6+pytestenables adding additional data. seeadditional-dataSupported DBlocal file system (local)Elasticsearch (es)Additional dataeach upload can include additional keys and valuesthe key will be defined in the config filethe value will be defined as a eitherconstfunction that will be invoked in after collecting the docsupported function languages:bashpythonconfig file example:...[additional-data][additional-data.consts]name='my-name'[additional-data.bash]os='lsb_release -sr'[additional-data.python]currentdirectory='import os; print(os.getcwd())'python functions will be called usingexecbash functions will be called usingsubprocess.check_outputConfig File ExampleES# optionaltitle='my pytest db plugin config'user='avin'# requiredtype='es'url='my-url'index='my-index'# optionalmust-upload=true[additional-data][additional-data.consts]name='avin'[additional-data.bash]os='lsb_release -sr'[additional-data.python]currentdirectory='import os; print(os.getcwd())'
Package: pytest-dbt-adapter
A test suite for adapter plugins.Installation and usepip install pytest-dbt-adapterYou'll need to install this package withpip install pytest-dbt-adapterand write a specfile, which is a yaml file ending in.dbtspec. See the included spark/postgres examples inspecs. You can also write custom test sequences and override existing default projects.After installing this package, you should be able to run your spec withpytest path/to/mytest.dbspec. You'll need dbt-core and your adapter plugin installed in the environment as well.This package also includes a module nameddbt_adapter_teststhat includes helpers for writing integration tests with Python if necessary. For maintainability purposes, this should only be used as a last resort for scenarios that are impossible to capture with a specfile.SpecsA spec is composed of a minimum of two things:atargetblockasequencesblockThe keys are test names. You can select from these names with pytest's-kflag.The values are test sequence definitions.Optionally, there is also:aprojectsblockTargetsA target block is just like a target block you'd use in dbt core. However, there is one special change: theschemafield should include a{{ var('_dbt_random_suffix') }}somewhere that the test suite will insert.SequencesA sequence has aname(the sequence name), aproject(the project name to use), andsequence(a collection of test steps). You can declare new sequences inline, or use the name of a builtin sequence. A sequence itself is just a list of steps. You can find examples in the form of the builtin sequences in thesequences/folder.You are encouraged to use as many sequences as you can from the built-in list without modification.ProjectsThe minimum project contains only anamefield. The value is the name of the project - sequences include a project name.A project also has an optionalpathsblock, where the keys are relative file paths (to adbt_project.ymlthat will be written), and the values are the contents of those files.There is adbt_project_ymlblock, which should be a dictionary that will be updated into the default dbt_project.yml (which sets name, version, and config-version).Instead of declaring anamefield, a project definition may have anoverridesfield that names a builtin project. The test suite will update the named builtin project with those overrides, instead of overwriting the full project with a new one.
Package: pytest-dbt-core
Pytest dbt core is apytestplugin for testing yourdbtprojects. Write unit test for your dbt logic with
pytest!:information_desk_person: User documentationThe user documentation is hosted onread the docs.:raising_hand: Contributing guideThe contributing guide ishere.:gift: How to releaseThe "how to release" guide ishere.:cop: LicenseThe license is givenhere.