You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tests included with this repository fail execution via an io.UnsupportedOperation: fileno
Expected Behavior
The expected behavior is that one should be able to provide the input and output streams as StringIO objects and run the Code. The tests rely on the ability to load configuration files/ input files via stdin at runtime.
Current Behavior
The current behavior is the tests fail with the following same result:
Possible Solution
The solution could be to change the assumption that r, w, e = select.select([sys.stdin], [], [], self.READ_TIMEOUT) requires the file descriptor type which is provided by fileno.
Steps to Reproduce
clone the repository
cd cortexutils
python -m unittest discover
Profit?? ;)
Context (Environment)
The reason this is affecting me is that I am trying to build tests for responders/analyzers that are built on top of this project. This is stopping those tests from running in similar fashion to the tests included in this repository.
The text was updated successfully, but these errors were encountered:
Based on looking up this specific error. It has to do with how we are checking that stdin stream has information. When that stream is changed to StringIO stream the tests will fail.
I found that if you change the check in the worker class to find if there is available input the tests don't fail in that way. Commented code is the old stuff. #r, w, e = select.select([sys.stdin], [], [], self.READ_TIMEOUT) if not sys.stdin.isatty(): #in r: self._input = json.load(sys.stdin) else: self.error('Input file doesn''t exist')
Now a bunch of the tests fail in other ways. It might be that they are slightly outdated as fpoutput is not apart of the analyzer class.
output = self.analyzer.fpoutput.getvalue().strip() line 116 of the test_suite_analyzer.py file.
This fixes the issue with the tests using StringIO to fake sys.stdin. I will put in a pull request with the above suggested fix. Then after that the rest of the test errors can be addressed.
The tests included with this repository fail execution via an io.UnsupportedOperation: fileno
Expected Behavior
The expected behavior is that one should be able to provide the input and output streams as StringIO objects and run the Code. The tests rely on the ability to load configuration files/ input files via stdin at runtime.
Current Behavior
The current behavior is the tests fail with the following same result:

Possible Solution
The solution could be to change the assumption that r, w, e = select.select([sys.stdin], [], [], self.READ_TIMEOUT) requires the file descriptor type which is provided by fileno.
Steps to Reproduce
Context (Environment)
The reason this is affecting me is that I am trying to build tests for responders/analyzers that are built on top of this project. This is stopping those tests from running in similar fashion to the tests included in this repository.
The text was updated successfully, but these errors were encountered: