From a8aac11380d0b936934718554d89bdcc390278bb Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sun, 28 Apr 2024 16:25:54 -0400 Subject: [PATCH] ci: Add pipe tests --- .github/workflows/ci.yml | 15 +++++++++++++++ csvkit/utilities/in2csv.py | 1 + 2 files changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7ced194..cce0be404 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,21 @@ jobs: csvstat < examples/dummy.csv in2csv -f csv < examples/dummy.csv sql2csv < examples/test.sql + - name: Read from pipe + run: | + printf 'a,b,c\n1,2,3' | csvclean + printf 'a,b,c\n1,2,3' | csvcut + printf 'a,b,c\n1,2,3' | csvformat + printf 'a,b,c\n1,2,3' | csvgrep -c1 -m1 + printf 'a,b,c\n1,2,3' | csvjoin + printf 'a,b,c\n1,2,3' | csvjson + printf 'a,b,c\n1,2,3' | csvlook + printf 'a,b,c\n1,2,3' | csvsort + printf 'a,b,c\n1,2,3' | csvsql + printf 'a,b,c\n1,2,3' | csvstack + printf 'a,b,c\n1,2,3' | csvstat + printf 'a,b,c\n1,2,3' | in2csv -f csv + printf 'SELECT 1 AS a' | sql2csv - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: coveralls --service=github diff --git a/csvkit/utilities/in2csv.py b/csvkit/utilities/in2csv.py index 57bc75e68..9248a51f5 100644 --- a/csvkit/utilities/in2csv.py +++ b/csvkit/utilities/in2csv.py @@ -64,6 +64,7 @@ def add_arguments(self): '-I', '--no-inference', dest='no_inference', action='store_true', help='Disable type inference (and --locale, --date-format, --datetime-format) when parsing CSV input.') + # This is called only from open_excel_input_file(), but is a separate method to use caching. @functools.lru_cache def stdin(self): return sys.stdin.buffer.read()