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

pythonPackages.yq: update, repackage as library, fix tests #98282

Merged
merged 3 commits into from Sep 21, 2020

Conversation

mweinelt
Copy link
Member

Motivation for this change

Part of our (@Mic92 and me) plan to package Mozilla TTS.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mweinelt
Copy link
Member Author

mweinelt commented Sep 21, 2020

One remaining test issue.

One test requires a certain exit code dependant on sys.stdin.isatty():

       self.run_yq("{}", [], expect_exit_codes={0} if sys.stdin.isatty() else {2})

https://github.com/kislyuk/yq/blob/v2.11.0/test/test.py#L87

Running the tests I get

E           SystemExit: 0
[...]
E   AssertionError: 0 not found in {2}

https://github.com/kislyuk/yq/blob/v2.11.0/test/test.py#L46-L47

So it thinks the test is not executed from a tty. Is that correct for our tests?

@jonringer
Copy link
Contributor

I would just disable it, as making an environment that is a tty I think is more construction than we care for.

@mweinelt
Copy link
Member Author

Replaced the {0} if sys.stdin.isatty() else {2} construct with {0}.

@mweinelt
Copy link
Member Author

Result of nixpkgs-review pr 98282 1

3 packages built:
  • python27Packages.yq
  • python37Packages.yq
  • yq (python38Packages.yq)

toml
];

checkPhase = "pytest ./test/test.py";
# tests fails if stdin is not a tty
checkPhase = "echo | script -c 'pytest ./test/test.py'";
Copy link
Member

Choose a reason for hiding this comment

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

Patch no longer required.

Copy link
Contributor

Choose a reason for hiding this comment

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

disgusting, but beautiful at the same time lol

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, the BSD script(1) doesn't have the -c option causing this to fail on macOS. Probably something like the following is required on macOS:

checkPhase = "echo | script typescript pytest ./test/test.py";

@Mic92
Copy link
Member

Mic92 commented Sep 21, 2020

Result of nixpkgs-review pr 98282 1

3 packages built:
  • python27Packages.yq
  • python37Packages.yq
  • yq (python38Packages.yq)

@Mic92 Mic92 merged commit 4eb5522 into NixOS:master Sep 21, 2020
@mweinelt mweinelt deleted the python/yq branch September 21, 2020 18:47
@veehaitch veehaitch mentioned this pull request Oct 16, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants