diff --git a/.gitignore b/.gitignore index fadb117..c55aa40 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ mkmf.log learn-test-*.gem *.swp +__pycache__ +.pytest_cache diff --git a/spec/features/pytest_unit_spec.rb b/spec/features/pytest_unit_spec.rb new file mode 100644 index 0000000..2f3182b --- /dev/null +++ b/spec/features/pytest_unit_spec.rb @@ -0,0 +1,10 @@ +describe "Running a Pytest Unit Test" do + context "a basic pytest unit test" do + it "runs the spec with 0 failures" do + output = `cd ./spec/fixtures/pytest-unit-spec && ./../../../bin/learn-test --local --test` + + expect(output).to include("2 passed") + expect(output).to_not include("1 failed") + end + end +end \ No newline at end of file diff --git a/spec/fixtures/pytest-unit-spec/dog.py b/spec/fixtures/pytest-unit-spec/dog.py new file mode 100644 index 0000000..f5739fe --- /dev/null +++ b/spec/fixtures/pytest-unit-spec/dog.py @@ -0,0 +1,5 @@ +class Dog(object): + + def __init__(self, name, breed): + self.name = name + self.breed = breed \ No newline at end of file diff --git a/spec/fixtures/pytest-unit-spec/pytests/test_dog.py b/spec/fixtures/pytest-unit-spec/pytests/test_dog.py new file mode 100644 index 0000000..344c3df --- /dev/null +++ b/spec/fixtures/pytest-unit-spec/pytests/test_dog.py @@ -0,0 +1,12 @@ +import pytest +from dog import * + +@pytest.fixture +def dog(): + return(Dog("Fido", "Good Boy")) + +def test_dog_name(dog): + assert dog.name == "Fido" + +def test_dog_breed(dog): + assert dog.breed == "Good Boy" \ No newline at end of file