Repository: oppia/oppia

Issue:
Back-end tests error out on develop
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
Post the merging of PR #5618, I think the back-end tests error out on develop (they had also error-ed out for that particular PR).
The following is the log:
```
File "/home/travis/build/oppia/oppia/core/platform/models.py", line 19, in <module>
    import feconf
  File "/home/travis/build/oppia/oppia/feconf.py", line 30, in <module>
    not os.environ['SERVER_SOFTWARE'].startswith('Development')):
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'SERVER_SOFTWARE'
```

**Additional context**
[Logs](https://travis-ci.org/oppia/oppia/jobs/428448507) from develop and [logs](https://travis-ci.org/oppia/oppia/jobs/426799186) from the PR itself.

/cc @vojtechjelinek 
Back-end tests error out on develop
<!--
  - Thanks for taking the time to report a bug in the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->

**Describe the bug**
Post the merging of PR #5618, I think the back-end tests error out on develop (they had also error-ed out for that particular PR).
The following is the log:
```
File "/home/travis/build/oppia/oppia/core/platform/models.py", line 19, in <module>
    import feconf
  File "/home/travis/build/oppia/oppia/feconf.py", line 30, in <module>
    not os.environ['SERVER_SOFTWARE'].startswith('Development')):
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'SERVER_SOFTWARE'
```

**Additional context**
[Logs](https://travis-ci.org/oppia/oppia/jobs/428448507) from develop and [logs](https://travis-ci.org/oppia/oppia/jobs/426799186) from the PR itself.

/cc @vojtechjelinek 


Discussion:
That's weird -- @apb7, if you take a look at https://travis-ci.org/oppia/oppia/builds/426799183?utm_source=github_status&utm_medium=notification, the Travis build for the backend test is passing. Some kind of false positive? I'm not sure why it's green and we should look into that and fix it.

In the meantime, to unblock develop, it's fine to do a PR reverting the relevant change to feconf.py. Could one of you do this please? Also add a comment to clarify that the check is needed for the travis tests to run fine.
That's weird -- @apb7, if you take a look at https://travis-ci.org/oppia/oppia/builds/426799183?utm_source=github_status&utm_medium=notification, the Travis build for the backend test is passing. Some kind of false positive? I'm not sure why it's green and we should look into that and fix it.

In the meantime, to unblock develop, it's fine to do a PR reverting the relevant change to feconf.py. Could one of you do this please? Also add a comment to clarify that the check is needed for the travis tests to run fine.

Resolving patch:
diff --git a/feconf.py b/feconf.py
--- a/feconf.py
+++ b/feconf.py
@@ -25,8 +25,10 @@
 # Whether to unconditionally log info messages.
 DEBUG = False
 
-# When DEV_MODE = true check that we are running in development enviroment.
-if (constants.DEV_MODE and
+# When DEV_MODE is true check that we are running in development enviroment.
+# The SERVER_SOFTWARE enviroment variable does not exist in Travis thus we need
+# to check it.
+if (constants.DEV_MODE and os.environ.get('SERVER_SOFTWARE') and
         not os.environ['SERVER_SOFTWARE'].startswith('Development')):
     raise Exception('DEV_MODE can\'t be true on production.')
 


Test patch: