Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
source =
torchx

omit =
*test*
12 changes: 11 additions & 1 deletion .github/workflows/python-unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ jobs:
- name: Install dependencies
run: |
set -eux
pip install coverage codecov
pip install -e .[dev]
- name: Run tests
run: python -m unittest discover --verbose --start-directory . --pattern "*_test.py"
run: coverage run -m unittest discover --verbose --start-directory . --pattern "*_test.py"
- name: Coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
set -eux
coverage report -m
coverage xml

codecov
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ cython_debug/

wordlist.dic
pipeline.yaml

/codecov
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[![PyPI](https://img.shields.io/pypi/v/torchx)](https://pypi.org/project/torchx/) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE) ![Tests](https://github.com/pytorch/torchx/actions/workflows/python-unittests.yaml/badge.svg) ![Lint](https://github.com/pytorch/torchx/actions/workflows/lint.yaml/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/torchx)](https://pypi.org/project/torchx/)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE)
![Tests](https://github.com/pytorch/torchx/actions/workflows/python-unittests.yaml/badge.svg)
![Lint](https://github.com/pytorch/torchx/actions/workflows/lint.yaml/badge.svg)
[![codecov](https://codecov.io/gh/pytorch/torchx/branch/main/graph/badge.svg?token=ceHHIm0hXy)](https://codecov.io/gh/pytorch/torchx)


# TorchX
Expand All @@ -24,9 +28,12 @@ TorchX Kubeflow Pipelines Support (torchx-kfp):
### Release

```bash
# install torchx sdk and CLI
# install torchx sdk and CLI -- minimum dependencies
pip install torchx

# install torchx sdk and CLI -- all dependencies
pip install "torchx[dev]"

# install torchx kubeflow pipelines (kfp) support
pip install "torchx[kfp]"

Expand Down
22 changes: 11 additions & 11 deletions torchx/specs/test/finder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)


def test_component(name: str, role_name: str = "worker") -> AppDef:
def _test_component(name: str, role_name: str = "worker") -> AppDef:
"""
Test component

Expand Down Expand Up @@ -94,10 +94,10 @@ def test_get_entrypoints_components(self) -> None:
with patch("torchx.specs.finder.entrypoints") as entrypoints_mock:
entrypoints_mock.load_group.return_value = test_torchx_group
components = _load_components()
foobar_component = components["foobar.finder_test.test_component"]
self.assertEqual(test_component, foobar_component.fn)
self.assertEqual("test_component", foobar_component.fn_name)
self.assertEqual("foobar.finder_test.test_component", foobar_component.name)
foobar_component = components["foobar.finder_test._test_component"]
self.assertEqual(_test_component, foobar_component.fn)
self.assertEqual("_test_component", foobar_component.fn_name)
self.assertEqual("foobar.finder_test._test_component", foobar_component.name)
self.assertEqual("Test component", foobar_component.description)

def test_get_base_module_name(self) -> None:
Expand Down Expand Up @@ -142,20 +142,20 @@ def current_file_path() -> str:
class CustomComponentsFinderTest(unittest.TestCase):
def test_find_components(self) -> None:
components = CustomComponentsFinder(
current_file_path(), "test_component"
current_file_path(), "_test_component"
).find()
self.assertEqual(1, len(components))
component = components[0]
self.assertEqual(f"{current_file_path()}:test_component", component.name)
self.assertEqual(f"{current_file_path()}:_test_component", component.name)
self.assertEqual("Test component", component.description)
self.assertEqual("test_component", component.fn_name)
self.assertEqual("_test_component", component.fn_name)
self.assertListEqual([], component.validation_errors)

def test_get_component(self) -> None:
component = get_component(f"{current_file_path()}:test_component")
self.assertEqual(f"{current_file_path()}:test_component", component.name)
component = get_component(f"{current_file_path()}:_test_component")
self.assertEqual(f"{current_file_path()}:_test_component", component.name)
self.assertEqual("Test component", component.description)
self.assertEqual("test_component", component.fn_name)
self.assertEqual("_test_component", component.fn_name)
self.assertListEqual([], component.validation_errors)

def test_get_components(self) -> None:
Expand Down