dockerized-pytest-course icon indicating copy to clipboard operation
dockerized-pytest-course copied to clipboard

Feedback

Open onelharrison opened this issue 5 years ago • 1 comments

Chapter 3 Video 3

Title: Parametrization

Description: The code in the video did not show how to update the test function's signature after implementing parametrization.

Example

FROM

def test_altitude_stat_per_country(process_data):
    ....

TO

@pytest.mark.parametrize('country,stat,expected', [
    (....),
    (....)
])
def test_altitude_stat_per_country(process_data, country, stat, expected):
    ....

Chapter 3 Video 2

Title: Factory fixtures

Description: The current condition meant to determine whether or not to read a CSV or JSON file will lead to always trying to read CSV files.

See PR #1. The _specify_type function is a bit confusing in that it seems to be communicating that it's able to find a file based on its filename or file type, when in reality it only needs to do a search for a given filename and use the appropriate file processor to read the file based on the file's type.

Example

def _specify_file(filename):
    files = os.listdir(city_list_location)

    for f in files:
        if filename == f:
            if filename.endswith('.json'):
                data = data_processor.json_reader(city_list_location + f)
            elif filename.endswith('.csv'):
                data = data_processor.csv_reader(city_list_location + f)

             return data

Misc

In some places we return from fixture functions and in others we yield, but there's no explanation for why we do one or the other.

[nit] In Chapter 2 Video 2 we introduce how to mark instance variables as private, but did not keep the instance variables for the Point class private for the videos following.

[nit] In Chapter 2 Video 4 we expected a ValueError to be raised where a TypeError would have been more appropriate. This is minor as the essential lesson on how to test for exceptions is not lost.

onelharrison avatar Mar 07 '20 02:03 onelharrison

Hey!

I'm only starting coding in Python now. I didn't watch the videos nor have any idea about the course you mention, but I inherited a Python project at work and my task was to add tests to it.

I was having problems with finding the code modules when running pytest and I spent a few hours googling round and trying to understand the problem and nothing helped. Then I found out this repo, had a look at how it was setup and turns out I was missing the "pytests.ini" file.

Thanks a lot for having this repo publicly available! :bowing_man:

a-pinheirocascais avatar Aug 20 '21 12:08 a-pinheirocascais