Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Adding support for pytest with tox for single test file #714

Merged
merged 3 commits into from
Jan 14, 2020

Conversation

ananno
Copy link
Contributor

@ananno ananno commented Jan 8, 2020

Motivation and Context

Often when we develop one python module in blueoil, to run unit testing we've to use pytest' on entire testsdirectory. This is time consuming. A simpler and efficient way to test only onetest_file` is needed in blueoil to run unit testing for one test file.

Description

Blueoil use tox to run the unit testing with proper environment setup. For python files test the command tox -e pytest is used from inside the blueoil/lmnet directory. But often we need to run one test file which is under development without wasting time to run full pytest unit testing on entire tests directory. This modification to tox.ini file add a command pytest-only which takes a command line argument and pass it on the the tox command. By this way we can run unit testing on a single python test file using tox.

  • Usage:
[blueoil/lmnet] $ tox -e pytest-only -- path/to/test_file.py

Above command will load the python test environment and configuration and run the provided python test file via command line argument.

NOTE : The -- symbol after the pytest-only command is mandatory. Which is a way to pass command line argument to tox command. Anything after -- symbol will be considered as argument.

How has this been tested?

tox -e pytest-only {path/to/single/test_file.py}

Screenshots (if appropriate):

Screenshot from 2020-01-09 17-23-17

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature / Optimization (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@ananno ananno self-assigned this Jan 8, 2020
@blueoil-butler blueoil-butler bot added the CI: auto-run Run CI automatically label Jan 8, 2020
@bo-code-review-bot
Copy link

This PR needs Approvals as follows.

  • Ownership Approval for / from iizukak, tkng, ruimashita

Please choose reviewers and requet reviews!

Click to see how to approve each reviews

You can approve this PR by triggered comments as follows.

  • Approve all reviews requested to you (readability and ownership) and LGTM review
    Approval, LGTM

  • Approve all ownership reviews
    Ownership Approval or OA

  • Approve all readability reviews
    Readability Approval or RA

  • Approve specified review targets

    • Example of Ownership Reviewer of /: Ownership Approval for / or OA for /
    • Example of Readability Reviewer of Python: Readability Approval for Python or RA for Python
  • Approve LGTM review
    LGTM

See all trigger comments

Please replace [Target] to review target

  • Ownership Approval
    • Ownership Approval for [Target]
    • OA for [Target]
    • Ownership Approval
    • OA
    • Approval
  • Readability Approval
    • Readability Approval for [Target]
    • RA for [Target]
    • [Target] Readability Approval
    • [Target] RA
    • Readability Approval
    • RA
    • Approval
  • LGTM
    • LGTM
    • lgtm

@ananno ananno changed the title WIP: Adding support for pytest with tox for single test file WIP : Adding support for pytest with tox for single test file Jan 9, 2020
@ananno ananno force-pushed the single_pytest_tox branch from c54d0bf to 700b94a Compare January 9, 2020 09:03
@ananno ananno requested review from iizukak and tsawada January 14, 2020 03:39
@ananno ananno changed the title WIP : Adding support for pytest with tox for single test file Adding support for pytest with tox for single test file Jan 14, 2020
@tsawada
Copy link
Contributor

tsawada commented Jan 14, 2020

This PR doesn't require readability review. Please add me back if there's anything specific for review

@tsawada tsawada removed their request for review January 14, 2020 03:58
Copy link
Member

@iizukak iizukak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ownership Approval

@iizukak
Copy link
Member

iizukak commented Jan 14, 2020

/ready

@bo-mergebot
Copy link
Contributor

bo-mergebot bot commented Jan 14, 2020

⏳Merge job is queued...

@bo-mergebot bo-mergebot bot merged commit 301da2f into blue-oil:master Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI: auto-run Run CI automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants