Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report | IndexError raised in test_Export.py when running pytest on Windows machine #30

Closed
braddaking opened this issue Apr 4, 2021 · 0 comments · Fixed by #42
Closed
Assignees
Labels
bug Something isn't working

Comments

@braddaking
Copy link

braddaking commented Apr 4, 2021

DO NOT DELETE THIS TEMPLATE

Describe The Bug

I get a index error whenever I run test_Export.py.

Expected Behavior

Basically the program should say test complete, no errors.

Actual Behavior

IndexError raised.

Steps To Reproduce

  • Ran custom script Scripts/python.exe.

Traceback, urs.log, or Screenshots

platform win32 -- Python 3.9.2, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- C:\Users\bradd\PycharmProjects\URS\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\bradd\PycharmProjects\URS
plugins: cov-2.11.1
collecting ... collected 1 item

test_Export.py::TestWriteCSVAndWriteJSON::test_write_csv FAILED          [100%]
tests\test_Export.py:197 (TestWriteCSVAndWriteJSON.test_write_csv)
self = <tests.test_Export.TestWriteCSVAndWriteJSON object at 0x00000279B527ED90>

    def test_write_csv(self):
        filename = os.path.join(sys.path[0], "test_csv_writing.csv")
        overview = {
            "this": [1, 2],
            "is": [3, 4],
            "a": [5, 6],
            "test": [7, 8]}
    
        Export.Export.write_csv(overview, filename)
    
        with open(filename, "r") as test_csv:
            reader = csv.reader(test_csv)
            test_dict = dict((header, []) for header in next(reader))
            for row in reader:
                for row_index, key in enumerate(test_dict.keys()):
>                   test_dict[key].append(int(row[row_index]))
E                   IndexError: list index out of range

test_Export.py:213: IndexError

Machine Specs

  • OS: Windows
  • Python: Python 3.9.2
  • PRAW: Unknown

Additional Context

N/A

@braddaking braddaking added the bug Something isn't working label Apr 4, 2021
@JosephLai241 JosephLai241 changed the title Bug Report Bug Report | IndexError raised in test_Export.py when running pytest on Windows machine Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants