Skip to main content
Avoid useless cat
Source Link
tripleee
  • 185.2k
  • 36
  • 295
  • 342

Assuming the test names are unique, you have to remove the test file's name:

cat foo.txt | cut -d : -f 3 foo.txt > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | "$(awk '$1=$1' RS= OFS=' or ' `" FAILED_TESTS.txt)"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

Assuming the test names are unique, you have to remove the test file's name:

cat foo.txt | cut -d : -f 3 > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | awk '$1=$1' RS= OFS=' or ' `"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

Assuming the test names are unique, you have to remove the test file's name:

cut -d : -f 3 foo.txt > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "$(awk '$1=$1' RS= OFS=' or '  FAILED_TESTS.txt)"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

deleted 19 characters in body
Source Link
anask
  • 371
  • 3
  • 5

Assuming the test names are unique, you have to remove the test file's name:

 cat foo.txt | cut -d : -f 5 | cut -d ' ' -f 13 > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | awk '$1=$1' RS= OFS=' or ' `"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

Assuming the test names are unique, you have to remove the test file's name:

 cat foo.txt | cut -d : -f 5 | cut -d ' ' -f 1 > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | awk '$1=$1' RS= OFS=' or ' `"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

Assuming the test names are unique, you have to remove the test file's name:

cat foo.txt | cut -d : -f 3 > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | awk '$1=$1' RS= OFS=' or ' `"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.

Source Link
anask
  • 371
  • 3
  • 5

Assuming the test names are unique, you have to remove the test file's name:

 cat foo.txt | cut -d : -f 5 | cut -d ' ' -f 1 > FAILED_TESTS.txt

As others pointed out use -k, but you have to pass the file's content (i.e., list of test names) as a single string:

pytest -k "`cat FAILED_TESTS.txt | awk '$1=$1' RS= OFS=' or ' `"

awk will replace the new lines with a delimiter or so that the test names are joined in a format that pytest expects.