Skip to content

Tests do not run in master repo. #311

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

Closed
w- opened this issue May 7, 2017 · 12 comments
Closed

Tests do not run in master repo. #311

w- opened this issue May 7, 2017 · 12 comments
Labels
difficulty: hard fix is hard in difficulty status: help wanted requesting help from the community type: question question directed at the library

Comments

@w-
Copy link
Contributor

w- commented May 7, 2017

Issue Summary

Tests do not run in master repo.

$ python -m unittest discover -v
test_initialization (test.test_config.UnitTests) ... ok
test_helloEmail (test.test_mail.UnitTests) ... ok
test_kitchenSink (test.test_mail.UnitTests) ... ok
test_parse (test.test_parse.UnitTests) ... {}
ok
Activating Prism (~20 seconds)
ERROR
/usr/lib/python3.4/unittest/suite.py:170: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'>
  self._addClassOrModuleLevelException(result, e, errorName)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
======================================================================
ERROR: setUpClass (test.test_sendgrid.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/w/hippo/sendgrid-python/test/test_sendgrid.py", line 55, in setUpClass
    "oai_stoplight.json"], stdout=devnull, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'prism'

----------------------------------------------------------------------
Ran 4 tests in 0.026s

FAILED (errors=1)
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name=4>
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name=5>
100  1353  100  1353    0     0    756      0  0:00:01  0:00:01 --:--:--   756

I notice if i do

git status

I get

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        prism_linux_amd64

nothing added to commit but untracked files present (use "git add" to track)

Steps to Reproduce

  1. clone repo
  2. craete virtualenv and install dependencies via pip
  3. attempt to run tests

Technical details:

  • latest master (e5323a7)
  • python 3.4.3
  • ubuntu 14.04
@thinkingserious
Copy link
Contributor

Hello @w-,

Could you try the following:

wget https://github.com/stoplightio/prism/releases/download/v2.0.0-alpha.3/prism_linux_amd64
mv ./prism_linux_amd64 /usr/local/bin/prism
rm ./prism_linux_amd64

Then run the tests.

Thanks!

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: question question directed at the library labels May 8, 2017
@w-
Copy link
Contributor Author

w- commented May 9, 2017

@thinkingserious so the issue here was the unexpected requirement that prism needs to be installed @ /usr/local/bin/ which requires root privileges.

If i'm running tests on a package I don't really expect to run them with root privs (which supposedly would allow the auto download and install of prism to that location)

Eventually from looking at the test setup source and the prism docs, i completed what was required manually (ala your preceding comment).
I think some elaboration on the requirement of prism in the docs would be beneficial.

@thinkingserious
Copy link
Contributor

Thank you @w-, this was very valuable feedback as I did not test in Ubuntu. Where do you suggest we install prism?

@w-
Copy link
Contributor Author

w- commented May 9, 2017

Far from being an ubuntu (or *nix) expert in general, I dont think i have good answers to this.

My understanding is that it is common to install things in the user's home directory under .local/bin or some variant of that. The python code can then make a call relative to the user's home directory.

Even the current location is ok, I think. There just needs to be additional documentation explaining prism is a dependency for running tests and how to install it.

@thinkingserious
Copy link
Contributor

Fair enough :)

The idea behind the script is that you should not need to know how to install it, it just happens for you.

We did have documentation on Prism here, but I removed it when we automated the install.

That said, I think you are correct, we should still document it. So I will leave this ticket open until I add that documentation.

Thanks again for your help!

@w-
Copy link
Contributor Author

w- commented May 9, 2017

np. thanks for being responsive.

@thinkingserious thinkingserious added difficulty: easy fix is easy in difficulty hacktoberfest labels Sep 30, 2017
@meahow
Copy link
Contributor

meahow commented Oct 1, 2017

I would like to look at this as well, but I am not clear with weather we should fine a solution on how to install and use prism without sudo on Ubuntus, ot just document it as a prerequisite.
EDIT:
Also, when I installed prism on my Ubuntu machine (16.10) I could not get it to work properly even with the basic tutorial commands. I submitted the issue for them stoplightio/prism/issues/80
It works on your docker image, though.
Maybe someone here could help me with this ?

@thinkingserious
Copy link
Contributor

Hi @meahow,

This issue was to document this behavior. If you figure out how to get it installed and working on Ubuntu, I will bump the difficulty to medium on this issue.

Thanks!

With Best Regards,

Elmer

@gabrielkrell
Copy link
Contributor

~/bin seems to be the convention (although I've never used it myself); ideally we'd just look elsewhere in that part of the tests. An underlying issue seems to be that Prism's installer.sh has /usr/local/bin/prism hardcoded.

@meahow Are you thinking of fixing the install problem? I might have a crack at it if you decide not to.

@meahow
Copy link
Contributor

meahow commented Oct 6, 2017

@gabrielkrell,
I am actually working on it. I hope to have PR ready today or tomorrow.
I got it working actually, but the problem is that there is some duplicated code between test_sendgrid.py, travis.yml, tox.ini and prism.sh.

The idea is to use test/prism.sh as a installer for prism (if it is not in the PATH yet) and document it on the CONTRIBUTING page.

@gabrielkrell
Copy link
Contributor

@meahow Sounds good!

@meahow
Copy link
Contributor

meahow commented Oct 7, 2017

I have created PR #364 .
Let me know what you think.

@mbernier mbernier added difficulty: hard fix is hard in difficulty and removed difficulty: easy fix is easy in difficulty labels Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: hard fix is hard in difficulty status: help wanted requesting help from the community type: question question directed at the library
Projects
None yet
Development

No branches or pull requests

5 participants