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

CLN: Removed duplicated test data #34477

Merged
merged 6 commits into from
Jun 8, 2020
Merged
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
2 changes: 1 addition & 1 deletion pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@pytest.fixture
def tips_file(datapath):
"""Path to the tips dataset"""
return datapath("io", "parser", "data", "tips.csv")
return datapath("io", "data", "csv", "tips.csv")


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/parser/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def csv_dir_path(datapath):


@pytest.fixture
def csv1(csv_dir_path):
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for doing this instead of editing csv_dir_path?

Copy link
Member Author

Choose a reason for hiding this comment

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

csv_dir_path is used across quite a few tests. We would have to move all csvs from io/parser/data to io/data/csv if we wanted to do this.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. I think makes sense to do that but can be done as a follow up

def csv1(datapath):
"""
The path to the data file "test1.csv" needed for parser tests.
"""
return os.path.join(csv_dir_path, "test1.csv")
return os.path.join(datapath("io", "data", "csv"), "test1.csv")


_cParserHighMemory = CParserHighMemory()
Expand Down
8 changes: 0 additions & 8 deletions pandas/tests/io/parser/data/test1.csv

This file was deleted.

245 changes: 0 additions & 245 deletions pandas/tests/io/parser/data/tips.csv

This file was deleted.

14 changes: 8 additions & 6 deletions pandas/tests/io/parser/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,21 @@ def test_read_csv_utf_aliases(all_parsers, utf_value, encoding_fmt):


@pytest.mark.parametrize(
"fname,encoding",
"file_path,encoding",
[
("test1.csv", "utf-8"),
("unicode_series.csv", "latin-1"),
("sauron.SHIFT_JIS.csv", "shiftjis"),
(("io", "data", "csv", "test1.csv"), "utf-8"),
(("io", "parser", "data", "unicode_series.csv"), "latin-1"),
(("io", "parser", "data", "sauron.SHIFT_JIS.csv"), "shiftjis"),
],
)
def test_binary_mode_file_buffers(all_parsers, csv_dir_path, fname, encoding):
def test_binary_mode_file_buffers(
all_parsers, csv_dir_path, file_path, encoding, datapath
):
# gh-23779: Python csv engine shouldn't error on files opened in binary.
# gh-31575: Python csv engine shouldn't error on files opened in raw binary.
parser = all_parsers

fpath = os.path.join(csv_dir_path, fname)
fpath = datapath(*file_path)
expected = parser.read_csv(fpath, encoding=encoding)

with open(fpath, mode="r", encoding=encoding) as fa:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/parser/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def check_compressed_urls(salaries_table, compression, extension, mode, engine):
@pytest.fixture
def tips_df(datapath):
"""DataFrame with the tips dataset."""
return read_csv(datapath("io", "parser", "data", "tips.csv"))
return read_csv(datapath("io", "data", "csv", "tips.csv"))


@pytest.mark.usefixtures("s3_resource")
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/parser/test_textreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class TestTextReader:
@pytest.fixture(autouse=True)
def setup_method(self, datapath):
self.dirpath = datapath("io", "parser", "data")
self.csv1 = os.path.join(self.dirpath, "test1.csv")
csv1_dirpath = datapath("io", "data", "csv")
self.csv1 = os.path.join(csv1_dirpath, "test1.csv")
self.csv2 = os.path.join(self.dirpath, "test2.csv")
self.xls1 = os.path.join(self.dirpath, "test.xls")

Expand Down